[solved] Visual C++ 2010 express. unresolved external symbol

pommaniulo

12-07-2011 11:44:29

Hi. Need help. I have not big skills in compiling and linking (

i download OgreSDK_vc10_v1-7-3

download and compile bullet-2.78 from repository

download and compile ogrebullet from repository (Dynamics and Collisions. not Demos.)

i compil and run 1st tutorial:
http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1&structure=Libraries
OK!
I think that this means that the paths and library found successful

i add string:
#include "OgreBulletDynamicsRigidBody.h" // for OgreBullet
it's still OK

But! after i add string:
#include "Shapes/OgreBulletCollisionsStaticPlaneShape.h" // for static planes

and have:

1>------ Построение начато: проект: bullet, Конфигурация: Debug Win32 ------
1> bullet.cpp
1> Создается библиотека bin\Debug\bullet.lib и объект bin\Debug\bullet.exp
1>OgreBulletCollisions_d.lib(OgreBulletCollisionsDebugLines.obj) : error LNK2001: неразрешенный внешний символ ""public: virtual void __thiscall Ogre::MovableObject::removeQueryFlags(unsigned long)" (?removeQueryFlags@MovableObject@Ogre@@UAEXK@Z)"
1>bin\Debug\\bullet.exe : fatal error LNK1120: 1 неразрешенных внешних элементов
========== Построение: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========

sorry for rus version ) some translate:

OgreBulletCollisions_d.lib(OgreBulletCollisionsDebugLines.obj) : error LNK2001: неразрешенный внешний символ ""public: virtual void __thiscall Ogre::MovableObject::removeQueryFlags(unsigned long)" (?removeQueryFlags@MovableObject@Ogre@@UAEXK@Z)"

Latin1

15-07-2011 02:53:52

I've had the "unresolved external symbol" error many times, and it's usually because I forgot to link the .lib files.

You should make sure you've linked all the OgreBullet .lib files to the project:

Add required elements. In the end it should contain these:

OgreMain_d.lib OIS_d.lib OgreBulletCollisions_d.lib OgreBulletDynamics_d.lib bulletcollision.lib bulletdynamics.lib LinearMath.lib GIMPACTutils.lib ConvexDecomposition.lib

Those are the library files for the Debug config. Also, make sure that you've indicated where to find the OgreBullet .lib files, or you could get another error.

This is assuming there aren't any problems with your OgreBullet and Bullet libraries. If removeQueryFlags() (the function in the error message) is in one of the projects you need to build OgreBullet, then I think it may not have been built properly.

Of course, it could be something else, I'm not an expert.

pommaniulo

15-07-2011 06:59:05

Thanks for the post. All libraries have been specified, and the ways too. I rechecked many times.
Now, I just rebuilt everything and it worked. I do not know where it was a mistake... (Linking is magic... for noobs like me ))))

captaincrunch80

15-07-2011 23:47:32

pommaliuo do not blame yourself!!

Linking is not that hard. But VisualStudio overcomplicates things, because you have to fill out lots of tricky gui-menus.

And Visual Studio is the worst IDE of all times. (i.e. Try a project wide string search -you can not even click the search results as link - at least in VS08, have not tried 10 yet)

I prefer Cmake or qmake combined with a compiler of my choice. Even native g++ Makefiles are easier than VS.

You could use QtCreator (my favourite IDE) with qmake and still use the VS2010 compiler. But GCC will do (if not better).

Look thats all project setup needed in a qtcreator .pro file for an ogre project:
Totally straight forward ... no nasty menu navigation.
Write down the libs you wanna link and you're done (ok this are linux paths, but it works under Windows too with the right paths there)


TEMPLATE = app
TARGET = OgreBasic

DESTDIR = app
OBJECTS_DIR = gen
MOC_DIR = gen
RCC_DIR = gen
UI_DIR = gen

HEADERS += \
OgreFramework.h \
OgreFramework.h \
DemoApp.h \
Utilitys.h \
OgreTerrainFactory.h \
FramelistenerPhysics.h \
heightmapcollisionshape.h

SOURCES += \
main.cpp \
OgreFramework.cpp \
DemoApp.cpp \
Utilitys.cpp \
OgreTerrainFactory.cpp \
FramelistenerPhysics.cpp

INCLUDEPATH += . \
/usr/include \
/usr/local/include \
/usr/include/OGRE \
/usr/local/include/bullet \
/usr/local/include/OgreBullet/Collisions \
/usr/local/include/OgreBullet \
/usr/local/include/OgreBullet/Dynamics

LIBS += -L/usr/lib \
-L/usr/lib/debug/usr/lib \
-L/usr/local/lib \
# Ogre
-lOgreMain \
-lOgreRTShaderSystem \
-lOgreRTShaderSystem \
-lOgreTerrain \
-lOgreProperty \
-lOIS \
# Physics
-lOgreBulletCol \
-lOgreBulletDyn \
-lGIMPACTUtils \
-lConvexDecomposition \
-lBulletSoftBody \
-lBulletDynamics \
-lBulletCollision \
-lLinearMath \
# Mesh/Effect generation
-lhydrax

OTHER_FILES += \
app/resources.cfg \
app/plugins.cfg




Conclusion: Drop Visual studio right in the Trash! ;) (And after doing that thrash windows too)