drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

Default settings error filter FilterClassName not found Windows #1746

Closed albaropereyra22 closed 1 year ago

albaropereyra22 commented 1 year ago

Describe the bug Once I point to what I think is the correct way to point to the default config.json file I get the following error on Windows.

To Reproduce Steps to reproduce the behavior:

  1. point to default settings drogon::app().loadConfigFile("C:\Users\dell\your_project_name\config.json");

Expected behavior Run with no errors Screenshots

image

Desktop (please complete the following information):

hwc0919 commented 1 year ago

Check your config.json. This is expected.

VladlenPopolitov commented 1 year ago

Could you check the string with file name. In C++ it should be: "C:\\Users\\dell\\your_project_name\\config.json" ( not "C:\Users\dell\your_project_name\config.json" as in your example)

Yesterday I did similar mistake despite 30+ years experience with C and C++. P.S. probably it is Github converted your code , and you have correct backslashes in your program

VladlenPopolitov commented 1 year ago

It is hard to believe, that problem in Windows can be with jsoncpp.dll file. If you ran debug code, but jsoncpp.dll in current folder or first in PATH is release version (or vice versa), json function silently fail (like file does not exists) and your program continue to work without configuration. Cmake configuration file configured to copy this file to build folder on every build. If it is copied wrong every time, you will have problems every run of the program during debug. I have jsoncpp in vcpkg, and debug folder (installed/x64-windows/debug/bin) put in first place before release versions of dll.

Check it. Build you program, copy debug version of jsoncpp.dll to Debug folder to exe file, run program.

albaropereyra22 commented 1 year ago

I figured it out. I had to comment out the default simple controller mapping. ex: //"simple_controllers_map": [ // { // "path": "C:\Users\dell\your_project_name\", // "controller": "TestCtrl", // "http_methods": [ // "get", // "post" // ], // "filters": [ // "FilterClassName" // ] // } //],

now I am having problems mapping TestCtrl but, that is a seperate issue.

Thanks for your help and yes I am using double dashes \.