oatpp / oatpp-swagger

OpenApi 3.0.0 docs + Swagger UI for oatpp services
https://oatpp.io/
Apache License 2.0
90 stars 51 forks source link

CMake compiling with oatapp linking issues #64

Open schnitzlein opened 2 years ago

schnitzlein commented 2 years ago

Hi thanks for that great project! :+1:

I am using arm toolchain with cmake and simply install oatpp and oatpp-swagger to /opt/... folder.

But meanwhile compile process some Error occured. If I not compile it with cmake and make than the main project only finds oatpp. The oatpp works fine, but I am not able to link the oatpp-swagger into project, no matter what I am trying.

Current compile error: firmware/oatpp-swagger/build$ make DESTDIR=/opt/ARM/binary/oatpp-swagger install [ 50%] Built target oatpp-swagger [ 62%] Building CXX object test/CMakeFiles/module-tests.dir/oatpp-swagger/ControllerTest.cpp.o In file included from /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/ControllerTest.cpp:7: /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/test-controllers/TestController.hpp: In member function ‘void TestController::Z__ENDPOINT_ADD_INFO_deleteUser(const std::shared_ptr<oatpp::web::server::api::Endpoint::Info>&)’: /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/test-controllers/TestController.hpp:255:39: error: no matching function for call to ‘oatpp::web::server::api::Endpoint::Info::addResponse(const oatpp::web::protocol::http::Status&)’ 255 | info->addResponse(Status::CODE_500); | ^ In file included from /home/csc/Documents/Projects/Viessmann/git/hems_firmware/oatpp/include/oatpp-1.3.0/oatpp/oatpp/web/server/api/ApiController.hpp:28, from /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/test-controllers/TestController.hpp:8, from /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/ControllerTest.cpp:7: /home/csc/Documents/Projects/Viessmann/git/hems_firmware/oatpp/include/oatpp-1.3.0/oatpp/oatpp/web/server/api/Endpoint.hpp:247:19: note: candidate: ‘template<class Wrapper> oatpp::web::server::api::Endpoint::Info::ContentHints& oatpp::web::server::api::Endpoint::Info::addResponse(const oatpp::web::protocol::http::Status&, const String&, const String&)’ 247 | ContentHints& addResponse(const oatpp::web::protocol::http::Status& status, const oatpp::String& contentType, const oatpp::String& responseDescription = oatpp::String()) { | ^~~~~~~~~~~ /home/csc/Documents/Projects/Viessmann/git/hems_firmware/oatpp/include/oatpp-1.3.0/oatpp/oatpp/web/server/api/Endpoint.hpp:247:19: note: template argument deduction/substitution failed: In file included from /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/ControllerTest.cpp:7: /home/csc/Documents/Projects/Viessmann/git/with_swagger/hems_firmware/oatpp-swagger/test/oatpp-swagger/test-controllers/TestController.hpp:255:39: note: candidate expects 3 arguments, 1 provided 255 | info->addResponse(Status::CODE_500); | ^ make[2]: *** [test/CMakeFiles/module-tests.dir/build.make:76: test/CMakeFiles/module-tests.dir/oatpp-swagger/ControllerTest.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:142: test/CMakeFiles/module-tests.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

schnitzlein commented 2 years ago

solved with the CMake Flag : cmake -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-RPi/toolchain.cmake -DOATPP_BUILD_TESTS=False ..

I spend some time in linking, and I was happy to get to the actual compiling point, because it shows me that the linking was successfull -> Test fails :D :)

Anyway.

Thanks for this project.

Solved