Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not build project successfully #927

Open
YamakiYume opened this issue Mar 31, 2024 · 0 comments
Open

Can not build project successfully #927

YamakiYume opened this issue Mar 31, 2024 · 0 comments

Comments

@YamakiYume
Copy link

I use VScode minGW Cmake and VCpkg to organize oatpp project, and I think that I link lib in a right way.
That is what my CMakelists file looks like:

cmake_minimum_required(VERSION 3.5)

project(TESTWEB)

set(CMAKE_CXX_STANDARD 14)

set(SOURCES
    handler.h
    hello_world.cpp
)

set(CMAKE_TOOLCHAIN_FILE "F:\\Tools\\VCpkg\\vcpkg-2024.03.25\\scripts\\buildsystems\\vcpkg.cmake")

include_directories(
    "F:\\Tools\\VCpkg\\vcpkg-2024.03.25\\packages\\oatpp_x64-windows\\include\\oatpp-1.3.0\\oatpp"
)

link_directories(
    "F:\\Tools\\VCpkg\\vcpkg-2024.03.25\\packages\\oatpp_x64-windows\\lib\\oatpp-1.3.0"
)

add_compile_definitions(_ITERATOR_DEBUG_LEVEL=0)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++ -lwsock32 -lws2_32")

set(CMAKE_PREFIX_PATH "F:\\Tools\\VCpkg\\vcpkg-2024.03.25\\installed\\x64-windows\\share\\oatpp; F:\\Tools\\VCpkg\\vcpkg-2024.03.25\\installed\\x64-windows\\bin")

find_package(oatpp CONFIG REQUIRED)

if (oatpp_FOUND)
    message(STATUS "Found oatpp library")
    add_executable(${PROJECT_NAME} ${SOURCES})
    target_link_libraries(${PROJECT_NAME} PRIVATE oatpp)
else()
    message(FATAL_ERROR "Failed to find oatpp library")
endif()

It can configure successfully, but never build.
The report shows that there are multiple functions have never defined.

[build] [ 50%] Linking CXX executable TESTWEB.exe
[build] D:/C++compiler/Mingw64_13.2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TESTWEB.dir/objects.a(hello_world.cpp.obj): in function `RunAppOnServer()':
[build] F:/Project/testWEB/hello_world.cpp:31: undefined reference to `oatpp::web::server::HttpRouter::createShared()'
[build] D:/C++compiler/Mingw64_13.2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: F:/Project/testWEB/hello_world.cpp:35: undefined reference to `oatpp::web::server::HttpConnectionHandler::createShared(std::shared_ptr<oatpp::web::server::HttpRouter> const&)'

Should I also install pkg like oatpp-curl?
However, the vcpkg can not install zlib, I still don't know why it went wrong.

-- Restarting build without parallelism
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: D:/Tools/CMake/bin/cmake.exe --build . --config Debug --target install -- -v -j21
    Working Directory: F:/Tools/VCpkg/vcpkg-2024.03.25/buildtrees/zlib/x64-windows-dbg
    See logs for more information:
      F:\Tools\VCpkg\vcpkg-2024.03.25\buildtrees\zlib\install-x64-windows-dbg-out.log
      F:\Tools\VCpkg\vcpkg-2024.03.25\buildtrees\zlib\install-x64-windows-dbg-out-1.log

Call Stack (most recent call first):
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  ports/zlib/portfile.cmake:26 (vcpkg_cmake_install)
  scripts/ports.cmake:175 (include)


error: building zlib:x64-windows failed with: BUILD_FAILED
Elapsed time to handle zlib:x64-windows: 5.2 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+zlib
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[zlib]+Build+error+on+x64-windows&body=Copy+issue+body+from+F%3A%2FTools%2FVCpkg%2Fvcpkg-2024.03.25%2Finstalled%2Fvcpkg%2Fissue_body.md

I've been stuck here for two days...
I would be very grateful if you help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant