drogon icon indicating copy to clipboard operation
drogon copied to clipboard

Failed to start the Debug

Open dunga1k58bh opened this issue 10 months ago • 4 comments

I'm newbie, when i start the application it got error. This is my main.cc

`#include <drogon/drogon.h>

int main() { drogon::app().setLogLevel(trantor::Logger::kTrace);

try {
    drogon::app().addListener("127.0.0.1", 2201);
    drogon::app().run();
}
catch (const std::exception& e) {
    std::cerr << "Error: " << e.what() << std::endl;
}

return 0;

} `

The code failed on line drogon::app().addListener("127.0.0.1", 2201); the exception throwed is 'Error: vector too long'

I'm using Visual Studio Community 2022, this is output when build the project with VsCode:

[main] Building folder: d:/Code/WebC++/DrogonWin/build [build] Starting build [proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE" --build d:/Code/WebC++/DrogonWin/build --config Debug --target ALL_BUILD -j 22 -- [build] MSBuild version 17.13.9+e0f243f1e for .NET Framework [build] [build] main.cc [build] DrogonWin_test.vcxproj -> D:\Code\WebC++\DrogonWin\build\test\Debug\DrogonWin_test.exe [build] DrogonWin.vcxproj -> D:\Code\WebC++\DrogonWin\build\Debug\DrogonWin.exe [driver] Build completed: 00:00:02.796 [build] Build finished with exit code 0

dunga1k58bh avatar Feb 21 '25 15:02 dunga1k58bh

This is callstack

Image

dunga1k58bh avatar Feb 21 '25 16:02 dunga1k58bh

I'm having the same problem. Did you figure it out?

Zilr avatar Mar 26 '25 16:03 Zilr

I'm not remember exactly what i do, but it may relate to cmake or vcpkg, you can check or update thoes tools and try again

dunga1k58bh avatar Mar 26 '25 17:03 dunga1k58bh

I also encountered this problem, I installed the dependencies using vcpkg. Finally, I found that when I ran cmake .. in the build directory, CMake used another openssl library on my computer instead of the openssl installed by vcpkg.

Image

I then fixed this by specifying cmake to use vcpkg.cmake, and the error no longer occurs.

cmake .. -DCMAKE_TOOLCHAIN_FILE=D:/Software/vcpkg/scripts/buildsystems/vcpkg.cmake

So I think you can check if you are using the wrong library.

Lzhjk1 avatar Sep 17 '25 09:09 Lzhjk1