Trying to build project using OGRE-next and getting linking error

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


dsobiera
Gnoblar
Posts: 9
Joined: Sat Apr 12, 2008 12:35 am

Trying to build project using OGRE-next and getting linking error

Post by dsobiera »

I'm VERY new to OGRE and am trying to learn the system. I built OGRE-next and I am using static libraries. I built v2.3.3, v3.0.0 and tried master.

When I try to use this line (from Tutorial 00) in my own project:

Code: Select all

    HlmsUnlit::getDefaultPaths( mainFolderPath, libraryFoldersPaths );

I get a bunch of linking errors.

Code: Select all

/usr/bin/ld: /home/myuser/src/vendor/ogre-next/build/Debug/lib/libOgreNextHlmsPbsStatic_d.a(OgreHlmsPbs.cpp.o): in function `Ogre::HlmsPbs::HlmsPbs(Ogre::Archive*, std::vector<Ogre::Archive*, std::allocator<Ogre::Archive*> >*)':
/home/myuser/src/vendor/ogre-next/Components/Hlms/Pbs/src/OgreHlmsPbs.cpp:270:(.text+0xad): undefined reference to `Ogre::ConstBufferPool::ExtraBufferParams::ExtraBufferParams(unsigned long, Ogre::BufferType, bool)'
/usr/bin/ld: /home/myuser/src/vendor/ogre-next/Components/Hlms/Pbs/src/OgreHlmsPbs.cpp:334:(.text+0xc1): undefined reference to `Ogre::ConstBufferPool::ConstBufferPool(unsigned int, Ogre::ConstBufferPool::ExtraBufferParams const&)'
/usr/bin/ld: /home/myuser/src/vendor/ogre-next/build/Debug/lib/libOgreNextHlmsPbsStatic_d.a(OgreHlmsPbs.cpp.o): in function `Ogre::HlmsPbs::~HlmsPbs()':
/home/myuser/src/vendor/ogre-next/Components/Hlms/Pbs/src/OgreHlmsPbs.cpp:346:(.text+0x594): undefined reference to `Ogre::ConstBufferPool::~ConstBufferPool()

My project's CMakeLists.txt looks like:

Code: Select all

cmake_minimum_required(VERSION 3.17)
project(hello_ogre_next)

set(CMAKE_CXX_STANDARD 17)

add_executable(hello_ogre_next main.cpp)

target_compile_options(hello_ogre_next 
        PRIVATE -w
        PRIVATE -msse
        PRIVATE -msse2
        PRIVATE -g
        )
target_include_directories(hello_ogre_next
        PRIVATE /home/myuser/src/vendor/ogre-next/OgreMain/include
        PRIVATE /home/myuser/src/vendor/ogre-next/build/Debug/include
        PRIVATE /home/myuser/src/vendor/ogre-next/Components/Hlms/Pbs/include
        PRIVATE /home/myuser/src/vendor/ogre-next/Components/Hlms/Unlit/include
        PRIVATE /home/myuser/src/vendor/ogre-next/Components/Hlms/Common/include)
target_link_directories(hello_ogre_next
        PRIVATE /home/myuser/src/vendor/ogre-next/build/Debug/lib
        PRIVATE /home/myuser/src/vendor/ogre-next-deps/build/ogredeps/lib)
target_link_libraries(hello_ogre_next
        OgreNextMainStatic_d
        OgreNextHlmsPbsStatic_d OgreNextHlmsUnlitStatic_d RenderSystem_GL3PlusStatic_d
        OgreSamplesCommon_d

    X11 xcb freeimage zzip Xt Xrandr Xaw

)

Any idea what library that I am missing to make these link errors go away?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5455
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1352

Re: Trying to build project using OGRE-next and getting linking error

Post by dark_sylinc »

Hi!

Linking is order-dependent on Linux.

If you change it to the following (OgreNextMainStatic_d is now last) it links fine:

Code: Select all

target_link_libraries(hello_ogre_next
        OgreNextHlmsPbsStatic_d OgreNextHlmsUnlitStatic_d RenderSystem_GL3PlusStatic_d
        OgreSamplesCommon_d OgreNextMainStatic_d

X11 xcb freeimage zzip Xt Xrandr Xaw

)
dsobiera
Gnoblar
Posts: 9
Joined: Sat Apr 12, 2008 12:35 am

Re: Trying to build project using OGRE-next and getting linking error

Post by dsobiera »

That fixed it. Thank you!