|
There are a few confusing error messages you can run into when compiling, linking, and debugging programs that use G3D.
Here are the common fixes.
Most linker errors are caused by linking against the wrong version of the G3D libraries.
VC6 needs the "win32-lib" directory, VC7.1 uses the "win32-lib-7" directory.
The VC8 libraries must currently be built from CVS by the end user. ("win32-lib-8" directory).
MSVCPRT.LIB(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >assign(class s td::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,unsigned int)" (?assign@?$basic_string?$char_traits@V?$allocator@std@QAEAAV12) already defined in xxx(yyy)
G3D changes the linker settings for files, so you should generally include <G3DAll.h> or include<graphics3d.h> before any other includes and use it in every source (or header) file. Also, include all of G3D and not just the specific class you are using.
Error C2440: 'delete' : cannot convert from 'class G3D::ReferenceCountedPointer<class G3D::GFont>' to '' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
You called delete on a reference counted class. You do not need to delete G3D::GFontRef, G3D::Texture::Ref or any other Ref class; just set them to NULL when you don't need them and the underlying memory will be recovered.
../include/ReferenceCount.h(159) : error C2664: 'setPointer' : cannot convert parameter 1 from 'class G3D::Shader *' to 'class SphereMap *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast D:.cpp(167) : see reference to function template instantiation '__thiscall G3D::ReferenceCountedPointer<class SphereMap>::G3D::ReferenceCountedPointer<class SphereMap>(const class G3D::ReferenceCountedPointer<clas s G3D::Shader> &)' being compiled
You tried to assign a reference counted pointer from the wrong type (e.g. Texture::Ref a = GFontRef::create().
error C2440: 'return' : cannot convert from 'class A *' to 'class B *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast d:.h(194) : see reference to function template instantiation 'class B *__cdecl G3D::ReferenceCountedPointer<class B>::safecast(class A *)' being compiled
You tried to assign a reference counted pointer from the wrong type (e.g. Texture::Ref a = GFontRef::create().
Program "randomly" crashes AMD systems
See the Microsoft Knowledge Base article.
undefined symbol SDL_main
The linking error: undefined symbol SDL_main can result from a main() function that doesn't have argc and argv arguments. For example: int main() {..}
is no good... make sure you have
int main(int argc, char **argv) {..}
Application Error: The application failed to initialize properly (0xc0000022). Click on OK to terminate the application.
At runtime, your program can't load the SDL.dll, zlib.dll, or glut32.dll dynamic libraries.
This is probably occurring because the current working directory is invalid or because the files and directory exist but cannot be accessed. This frequently occurs when a Windows program is running from a Linux file system via Samba. Make sure you have set the eXecute
bit on the DLL's from Linux.
../include/G3D/g3dmath.h:27: limits: No such file or directory
You are using an old version of GCC on Linux. Add these lines to your .cshrc:
setenv CC gcc-3.2
setenv CXX g++-3.2
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_strin g?$char_traits@V?$allocator@std@QAE) already defined in main.obj
...
MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncpy already defined in LIBCD.lib(strncpy.obj) MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj) LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library Debug/GLG3D_Demo.exe : fatal error LNK1169: one or more multiply defined symbols found
You are linking against the wrong standard library. Navigate the MSVC menus to Project:Settings:C++:Code Generation and select "Debug Multithreaded DLL" for your debug build and "Multithreaded DLL" for your release build.
array.h(233) : error C2512: : no appropriate default constructor available array.h(195) : while compiling class-template member function 'void __thiscall G3D::Array<class X>::resize(int,bool)'
You created a G3D::Array of a class that does not provide a default constructor (constructor with no arguments). Define a default constructor for your class-- G3D::Array needs it to initialize new elements when you invoke G3D::Array::resize().
sdlmain.lib(SDL_main.obj) : error LNK2005: _main already defined in main.obj
You need to #include <SDL.h> in your main.cpp file.
error LNK2001: unresolved external symbol _glActiveTextureARB
Some other (e.g. MSVC .NET) program's include directory is listed before the G3D directory and contains conflicting OpenGL drivers. Reorder the include directories under Tools/Options/Directories
fatal error C1083: Cannot open include file: 'G3DAll.h': No such file or directory
You need to add the g3d/include directory to your include path.
LINK : fatal error LNK1181: cannot open input file "glg3d.lib"
You need to add the graphics3d/lib directory to your library path (instructions above)
"warning LNK4229: invalid directive" in MSVC build
When linking against G3D's libraries the following linker errors are produced G3D-debug.lib(TextInput.obj) : warning LNK4229: invalid directive '/alternatename:__imp_??$?9DU?$char_traits@V?$allocator@std@YA_NABV?$basic_string?$char_traits@V?$allocator@0=__imp_??9std@YA_NABV?$basic_string?$char_traits@V?$allocator@0' encountered; ignored G3D-debug.lib(TextInput.obj) : warning LNK4229: invalid directive '/alternatename:__imp_??$?8DU?$char_traits@V?$allocator@std@YA_NABV?$basic_string?$char_traits@V?$allocator@0=__imp_??8std@YA_NABV?$basic_string?$char_traits@V?$allocator@0' encountered; ignored G3D-debug.lib(TextInput.obj) : warning LNK4229: invalid directive '/alternatename:__imp_??$?8DU?$char_traits@V?$allocator@std@YA_NABV?$basic_string?$char_traits@V?$allocator@0=__imp_??8std@YA_NABV?$basic_string?$char_traits@V?$allocator@0' encountered; ignored etc...
Odds are you're linking against the wrong version of the libraries. Current G3D distributions include two versions of windows libraries. For MSVC version 6, the libraries reside in win32-lib, and for version 7.0 (MSVC dot net) win32-lib7. Note there are TWO MSVC "dot net" versions, 7.0 (2002) and 7.1 (2003). They are incompatible with each other. If you have the latest 7.1 version, or any more recent version (such as the free Visual C++ 2005 Express Beta) you will need to build the libraries on your own.
G3D-debug.lib(jutils.obj) : fatal error LNK1202: "vc60.pdb" is missing debugging information for referencing module
That means you are using a build that was created with debugging info, but you don't have the program database (pdb) that was built with it. The most common cause is using G3D on a different machine than the one on which you compiled G3D.
There are three solutions:
1. Build G3D on your local machine
2. Build G3D without debug info (Project:Settings:C++:Debug Info)
3. Use an official G3D build, since they are created without debug info.
My G3D based project will not build with Visual Studio 2005
or
Error linking:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::iterator __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::end(void)"
G3D 6.07 and below does not include library files that link with Visual Studio 2005 (VC++ 8 runtime), as VS2005 was not available at the time of G3D release. This problem will be solved with the upcoming release of G3D 6.08. Until then, the recommended solution is to checkout the CVS source of G3D, open the solution in VS2005 and convert the project. Then build the libraries. This will build the library files with VC++ 8, which can then be used with a VS2005 based project.
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: Warning: type of symbol `glGenerateMipmapEXT' changed from 2 to 1 in /t/3rdParty/g3d-6_07/linux-lib/libGLG3D_debug.a(libGLG3D_debug_a-glcalls.o)
And
/t/3rdParty/g3d-6_07/linux-lib/libGLG3D_debug.a(libGLG3D_debug_a-Texture.o)(.text+0x18e): In function `dimensionToTarget': ../../../source/GLG3Dcpp/Texture.cpp:82: undefined reference to `G3D_internal::_releaseInputGrab_()'
The source is being linked in the wrong order for the dependencies. To fix this, link GLG3D, G3D and then GL in that order. A sample compile command would look like:
g++ -L<DIRECTORY> -o<OUTPUT>./main.o -lGLG3D_debug -ljpeg -lSDL -lpng -lG3D_debug -lGL -lGLU
Generated on Thu Aug 2 11:40:43 2007 for G3D by
1.5.2
Hosted by
|