3
저는 cmake가 작동 중이며 모든 것이 작동하기는하지만, 가장 간단한 예제 (간단한 로깅)는 링커 오류로 컴파일되지 않습니다. 나는 정말로 무엇을해야할지 모른다.Boost + Mingw-w64 + Boost 로그가 작동하지 않습니다.
여기 여기 내 현재 CMake 설치
FIND_PACKAGE(Boost 1.54.0 COMPONENTS log log_setup REQUIRED)
...
TARGET_LINK_LIBRARIES(cogtd ${LIBS} ${SDL2_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
입니다
C:\MingW64\mingw64\bin\g++.exe -std=c++11 -g -mwindows -Wl,--whole-archive CMakeFiles\cogtd.dir/objects.a -Wl,--no-whole-archive -o cogtd.exe -Wl,--out-implib,libcogtd.dll.a -Wl,--major-image-version,0,--minor-image-version,0 C:\boost_1_54_0\stage\lib\libboost_log-mgw48-mt-d-1_54.dll C:\boost_1_54_0\stage\lib\libboost_log_setup-mgw48-mt-1_54.dll SDLHelper\libSDLHelper.a Event\libEvent.a Component\libComponent.a Error\libError.a -lmingw32 C:\SDL2-2.0.0\x86_64-w64-mingw32\lib\libSDL2main.a C:\SDL2-2.0.0\x86_64-w64-mingw32\lib\libSDL2.dll.a C:\boost_1_54_0\stage\lib\libboost_log-mgw48-mt-d-1_54.dll C:\boost_1_54_0\stage\lib\libboost_log_setup-mgw48-mt-1_54.dll -lmingw32 C:\SDL2-2.0.0\x86_64-w64-mingw32\lib\libSDL2main.a C:\SDL2-2.0.0\x86_64-w64-mingw32\lib\libSDL2.dll.a -lstdc++ -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `SDL_main':
C:\cygwin\home\Cogman\cogtd\build\src/../../src/main.cxx:53: undefined reference to `boost::log::v2s_mt_nt5::trivial::logger::get()'
C:\cygwin\home\Cogman\cogtd\build\src/../../src/main.cxx:53: undefined reference to `boost::log::v2s_mt_nt5::trivial::logger::get()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::record::reset()':
C:/boost_1_54_0/boost/log/core/record.hpp:153: undefined reference to `boost::log::v2s_mt_nt5::record_view::public_data::destroy(boost::log::v2s_mt_nt5::record_view::public_data const*)'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::record boost::log::v2s_mt_nt5::sources::basic_composite_logger<char, boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level>, boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex>, boost::log::v2s_mt_nt5::sources::features<boost::log::v2s_mt_nt5::sources::severity<boost::log::v2s_mt_nt5::trivial::severity_level> > >::open_record<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity, boost::log::v2s_mt_nt5::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity, boost::log::v2s_mt_nt5::trivial::severity_level const> const&)':
C:/boost_1_54_0/boost/log/sources/basic_logger.hpp:457: undefined reference to `boost::log::v2s_mt_nt5::core::get_logging_enabled() const'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::aux::record_pump<boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level> >::~record_pump()':
C:/boost_1_54_0/boost/log/sources/record_ostream.hpp:278: undefined reference to `boost::log::v2s_mt_nt5::aux::unhandled_exception_count()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::aux::record_pump<boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level> >::record_pump(boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level>&, boost::log::v2s_mt_nt5::record&)':
C:/boost_1_54_0/boost/log/sources/record_ostream.hpp:258: undefined reference to `boost::log::v2s_mt_nt5::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_nt5::record&)'
C:/boost_1_54_0/boost/log/sources/record_ostream.hpp:259: undefined reference to `boost::log::v2s_mt_nt5::aux::unhandled_exception_count()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::aux::record_pump<boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level> >::auto_release::~auto_release()':
C:/boost_1_54_0/boost/log/sources/record_ostream.hpp:243: undefined reference to `boost::log::v2s_mt_nt5::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_nt5::aux::stream_provider<char>::stream_compound*)'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex>::lock_shared() const':
C:/boost_1_54_0/boost/log/sources/threading_models.hpp:74: undefined reference to `boost::log::v2s_mt_nt5::aux::light_rw_mutex::lock_shared()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex>::unlock_shared() const':
C:/boost_1_54_0/boost/log/sources/threading_models.hpp:78: undefined reference to `boost::log::v2s_mt_nt5::aux::light_rw_mutex::unlock_shared()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::sources::aux::severity_level<boost::log::v2s_mt_nt5::trivial::severity_level>::set_value(boost::log::v2s_mt_nt5::trivial::severity_level)':
C:/boost_1_54_0/boost/log/sources/severity_feature.hpp:135: undefined reference to `boost::log::v2s_mt_nt5::sources::aux::get_severity_level()'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::record boost::log::v2s_mt_nt5::sources::basic_logger<char, boost::log::v2s_mt_nt5::sources::severity_logger_mt<boost::log::v2s_mt_nt5::trivial::severity_level>, boost::log::v2s_mt_nt5::sources::multi_thread_model<boost::log::v2s_mt_nt5::aux::light_rw_mutex> >::open_record_unlocked<boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity, boost::log::v2s_mt_nt5::trivial::severity_level const> >(boost::parameter::aux::tagged_argument<boost::log::v2s_mt_nt5::keywords::tag::severity, boost::log::v2s_mt_nt5::trivial::severity_level const> const&)':
C:/boost_1_54_0/boost/log/sources/basic_logger.hpp:260: undefined reference to `boost::log::v2s_mt_nt5::core::open_record(boost::log::v2s_mt_nt5::attribute_set const&)'
CMakeFiles\cogtd.dir/objects.a(main.cxx.obj): In function `boost::log::v2s_mt_nt5::core::push_record(boost::log::v2s_mt_nt5::record&&)':
C:/boost_1_54_0/boost/log/core/core.hpp:308: undefined reference to `boost::log::v2s_mt_nt5::core::push_record_move(boost::log::v2s_mt_nt5::record&)'
collect2.exe: error: ld returned 1 exit status
src\CMakeFiles\cogtd.dir\build.make:130: recipe for target 'src/cogtd.exe' failed
make.exe[2]: *** [src/cogtd.exe] Error 1
make.exe[2]: Leaving directory 'C:/cygwin/home/Cogman/cogtd/build'
CMakeFiles\Makefile2:94: recipe for target 'src/CMakeFiles/cogtd.dir/all' failed
make.exe[1]: *** [src/CMakeFiles/cogtd.dir/all] Error 2
make.exe[1]: Leaving directory 'C:/cygwin/home/Cogman/cogtd/build'
Makefile:118: recipe for target 'all' failed
make.exe: *** [all] Error 2
부스트가 동적 라이브러리를 사용하여 컴파일 에러 로그입니다.
Boost-1.54, Mingw-w64 4.8.1 버전 5 (x64 seh posix 버전) 및 Cmake 2.8.11을 사용하고 있습니다. 정적 링크를 사용하지 않으려 고 시도했습니다.
합니까 [이 답변] 시도에 추가 (http://stackoverflow.com/a/17868918/2556117) 도움이 필요하십니까? – Fraser
그래, 그 조각이 누락되었습니다. 감사합니다 – Cogman
다행히 도왔습니다. 나는 이것을 [Boost.Log와 CMake가 정의되지 않은 참조 오류의 원인으로] 복제 한 것으로 표시했습니다. (http://stackoverflow.com/questions/17844085/boost-log-with-cmake-causing-undefined-reference-error) – Fraser