是的,我读了很多前任的问题。这和这和这和这但对我来说没有任何作用。所以基本上我正在尝试编译食人魔网状但我收到错误
[100%] Linking CXX executable bin/RelWithDebInfo/OgreMeshy
/usr/bin/ld: CMakeFiles/OgreMeshy.dir/src/Core/AnimationPanel.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
//usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/OgreMeshy.dir/build.make:234: recipe for target 'bin/RelWithDebInfo/OgreMeshy' failed
make[2]: *** [bin/RelWithDebInfo/OgreMeshy] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/OgreMeshy.dir/all' failed
make[1]: *** [CMakeFiles/OgreMeshy.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
所以我尝试将 boost_system 添加到我的 CMakeLists 中,如下所示
if( UNIX )
set( CMAKE_CXX_STANDARD 98 )
#
target_link_libraries( OgreMeshy ${GTK2_LIBRARIES} ${OPENGL_LIBRARIES} boost_system )
但这给了我另一个错误
[100%] Linking CXX executable bin/RelWithDebInfo/OgreMeshy
CMakeFiles/OgreMeshy.dir/src/Core/AnimationPanel.cpp.o: In function `AnimationPanel::showBones(bool)':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/AnimationPanel.cpp:138: undefined reference to `Ogre::Skeleton::getRootBones() const'
CMakeFiles/OgreMeshy.dir/src/Core/MovableText.cpp.o: In function `Ogre::MovableText::setFontName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/MovableText.cpp:62: undefined reference to `Ogre::ResourceManager::remove(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/MovableText.cpp:75: undefined reference to `Ogre::ResourceManager::remove(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/OgreMeshy.dir/src/Core/MovableText.cpp.o: In function `Ogre::MovableText::~MovableText()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/MovableText.cpp:55: undefined reference to `Ogre::ResourceManager::remove(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/OgreMeshy.dir/src/Core/MovableText.cpp.o: In function `Ogre::MovableText::_setupGeometry()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/MovableText.cpp:207: undefined reference to `Ogre::VertexBufferBinding::setBinding(unsigned short, Ogre::SharedPtr<Ogre::HardwareVertexBuffer> const&)'
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/MovableText.cpp:216: undefined reference to `Ogre::VertexBufferBinding::setBinding(unsigned short, Ogre::SharedPtr<Ogre::HardwareVertexBuffer> const&)'
CMakeFiles/OgreMeshy.dir/src/Core/MovableText.cpp.o:(.rodata._ZTVN4Ogre11MovableTextE[_ZTVN4Ogre11MovableTextE]+0x50): undefined reference to `Ogre::MovableObject::getShadowVolumeRenderableIterator(Ogre::ShadowTechnique, Ogre::Light const*, Ogre::SharedPtr<Ogre::HardwareIndexBuffer>*, unsigned long*, bool, float, unsigned long)'
CMakeFiles/OgreMeshy.dir/src/Core/MovableText.cpp.o:(.rodata._ZTVN4Ogre11MovableTextE[_ZTVN4Ogre11MovableTextE]+0x68): undefined reference to `Ogre::ShadowCaster::generateShadowVolume(Ogre::EdgeData*, Ogre::SharedPtr<Ogre::HardwareIndexBuffer> const&, unsigned long&, Ogre::Light const*, std::vector<Ogre::ShadowRenderable*, std::allocator<Ogre::ShadowRenderable*> >&, unsigned long)'
CMakeFiles/OgreMeshy.dir/src/Core/wxOgreMeshViewerMainFrameImpl.cpp.o: In function `MeshyMainFrameImpl::unloadResourcesCfg()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreMeshViewerMainFrameImpl.cpp:927: undefined reference to `Ogre::ResourceGroupManager::getResourceGroups[abi:cxx11]() const'
CMakeFiles/OgreMeshy.dir/src/Core/wxOgreMeshViewerMainFrameImpl.cpp.o: In function `MeshyMainFrameImpl::viewGridSettings()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreMeshViewerMainFrameImpl.cpp:1235: undefined reference to `Ogre::ResourceManager::remove(Ogre::SharedPtr<Ogre::Resource> const&)'
CMakeFiles/OgreMeshy.dir/src/Core/wxOgreMeshViewerMainFrameImpl.cpp.o: In function `MeshyMainFrameImpl::showMeshInfo()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreMeshViewerMainFrameImpl.cpp:979: undefined reference to `Ogre::Entity::getSubEntity(unsigned long) const'
CMakeFiles/OgreMeshy.dir/src/Core/wxOgreMeshViewerMainFrameImpl.cpp.o: In function `MeshyMainFrameImpl::loadResourcesCfg(wxString const&)':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreMeshViewerMainFrameImpl.cpp:848: undefined reference to `Ogre::Entity::getSubEntity(unsigned long) const'
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreMeshViewerMainFrameImpl.cpp:914: undefined reference to `Ogre::Entity::getSubEntity(unsigned long) const'
CMakeFiles/OgreMeshy.dir/src/Core/wxOgreRenderWindow.cpp.o: In function `wxOgreRenderWindow::CreateRenderWindow()':
/home/slobodan/dark_sylinc-ogremeshy-2110b963ee28/src/Core/wxOgreRenderWindow.cpp:179: undefined reference to `Ogre::Root::createRenderWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int, bool, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const*)'
collect2: error: ld returned 1 exit status
CMakeFiles/OgreMeshy.dir/build.make:234: recipe for target 'bin/RelWithDebInfo/OgreMeshy' failed
make[2]: *** [bin/RelWithDebInfo/OgreMeshy] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/OgreMeshy.dir/all' failed
make[1]: *** [CMakeFiles/OgreMeshy.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
我也尝试过提到的东西这里但这也不起作用。这是我的 CMakeLists
#-------------------------------------------------------------------
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
project( OgreMeshy )
cmake_minimum_required(VERSION 2.8)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG" )
if( CMAKE_BUILD_TYPE STREQUAL "" )
set( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: Debug Release RelWithDebInfo MinSizeRel." FORCE )
endif()
include( CMake/Dependencies/OGRE.cmake )
include( CMake/Dependencies/wxWidgets.cmake )
include( CMake/Install.cmake )
setupOgre( OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES )
setupWxWidgets( wxWidgets_LIBRARIES GTK2_LIBRARIES OPENGL_LIBRARIES )
# Setup our application
set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" )
if( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /arch:SSE2")
add_definitions( -DUNICODE -D_UNICODE )
endif()
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c )
endmacro()
include_directories( "./include" )
add_recursive( ./src SOURCES )
add_recursive( ./include HEADERS )
if( WIN32 )
# Add embedded icon
set( SOURCES ${SOURCES} ./scripts/Resources/Resource.rc )
endif()
add_executable( ${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS} )
target_link_libraries( ${PROJECT_NAME} ${OGRE_LIBRARIES} ${wxWidgets_LIBRARIES} )
if( UNIX )
set( CMAKE_CXX_STANDARD 98 )
#
target_link_libraries( OgreMeshy ${GTK2_LIBRARIES} ${OPENGL_LIBRARIES} boost_system )
endif()
#Copy resources to bin folders
macro( copy_resources BUILD_TYPE )
file( REMOVE_RECURSE "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources" )
file( COPY "./scripts/Resources/Fonts" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources" )
file( COPY "./scripts/Resources/Icons" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources" )
file( COPY "./scripts/Resources/Other" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources" )
file( RENAME "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Other" "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Axis.material" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Axis.mesh" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Bones/BoneMesh.material" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Bones/Bones.png" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Bones/BoneTip.mesh" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
file( COPY "./scripts/Resources/Blender/Bones/BoneGlobe.mesh" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/Models" )
if( USE_RTSS )
file( COPY "${OGRE_SOURCE}/Samples/Media/RTShaderLib" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources" )
endif()
if( UNIX )
file( COPY "./scripts/Resources/OgreIcon.ico" DESTINATION "${CMAKE_SOURCE_DIR}/bin/${BUILD_TYPE}/Resources/" )
endif()
endmacro()
copy_resources( "Debug" )
copy_resources( "Release" )
copy_resources( "RelWithDebInfo" )
copy_resources( "MinSizeRel" )
setupInstallers()
我尝试添加
find_package(Boost 1.58.0 COMPONENTS filesystem system REQUIRED)
但它不起作用我也尝试添加
"LDFLAGS=-lm"
但我有同样的错误