jsoncpp
jsoncpp copied to clipboard
"Warning: corrupt .drectve at end of def file" error when building with CMake
Describe the bug I'm getting a "Warning: corrupt .drectve at end of def file" error at compilation time when trying to build with CMake. I'm using a fresh install of CLion (obtainable here) on Windows 11.
To Reproduce Steps to reproduce the behavior (assuming that vcpkg and CLion are correctly installed):
- Create a new project in CLion
- Run
vcpkg integrate install, it will execute and print a statement similar to this one:CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" - Go to File > Settings > Build, Execution, Deployment > Toolchains > CMake and paste the string obtained in the previous step in CMake Options, then apply
- Run
vcpkg install jsoncpp, it will print a statement similar to this one:jsoncpp provides CMake targets:# this is heuristically generated, and may not be correctfind_package(jsoncpp CONFIG REQUIRED)target_link_libraries(main PRIVATE jsoncpp_lib jsoncpp_object JsonCpp::JsonCpp) - Paste those two lines in the
CMakeLists.txtfile inside the project and substitutemainwith the project's name - Run the project and it should stop at compilation time with this error:
Warning: corrupt .drectve at end of def file
Expected behavior I'm expecting the program to correctly build and run.