Advertisement

FTGL linking problem!

Started by January 27, 2005 04:05 PM
2 comments, last by DarkNebula 19 years, 7 months ago
Well, after compiling the .a in Linux, I brought it over to DevC++ and linked it right in there... But I keep getting this... [Linker error] undefined reference to `FTGLTextureFont::FTGLTextureFont(char const*)' I have no idea why! I even tried the Windows Visual C++ version and I still get the same error. Please help! Code:

#ifndef GUI_FONT_WRAPPERNESS_
#define GUI_FONT_WRAPPERNESS_

#include <FTGLTextureFont.h>

class CFont {
	FTFont *font;
public:
	CFont(const char *FileName)	{ font = new FTGLTextureFont(FileName);	};
};

	
#endif

I compiled it on Linux, but it won't compile in DevC++! Any ideas? I tried so many different orders and nothing at all. I'm using the same exact .a too! Here is my linker list...

-lmingw32
-lSDLmain
-lSDL
-lopengl32
-lglu32
-lftgl

Someone say something!! Wahhhhhh I'm getting depressed lol

[Edited by - DarkNebula on January 28, 2005 2:18:21 PM]
Advertisement
Have you tried compiling the .a in a Win32 environment? If I recall correctly, windows and linux .a files are different. What's happening is that the FTGLTextureFont constructor is not being exported correctly from the library file. Try building the FTGL .a file in DevCPP and then using that.

In the readme file of the Win32 version of FTGL, it says this:

FTGL 1.31NOTES FOR COMPILING ON WINDOWS 14 Feb 2002Ellers, ellers@iinet.net.auSUPPORTED COMPILERSI have rebuilt the FTGL project files for Visual C++ (version 6). There arepresently no other compilers or environments supported but feel free tocontribute them. QUICK GUIDE: COMPILING FTGL - Start up MSVC++ with ftgl.dsw.  - Tell MSVC++ where FreeType is. You'll need to do something like this:      *  select Project&gt;Settings     *  select ftgl_static (for a start)     *  select "All Configurations"     *  go to the tab C++ &gt; PreProcessor     *  Set additional include directories appropriately. For me it is:        D:\cots\freetype-2.0.5\include     *  repeat for all configurations of ftgl_dllQUICK GUIDE: COMPILING/RUNNING SUPPLIED DEMO PROGRAM  - The program expects the first argument to be the name of a truetype file.   I copied timesbi.ttf from the windows directory to C:\TEMP and then edit   the settings of the project:       * select Project&gt;Settings    * select Demo project    * select panel Debug&gt;General    * set Program Arguments to be "C:\TEMP\timesbi.ttf"QUICK GUIDE: COMPILING YOUR PROGRAM TO USE FTGL - Choose dynamic or static library linkage     *  if you want to link to a static FTGL library ensure that         FTGL_LIBRARY_STATIC is defined in the preprocessor section     CONFIGURATION / CODE GENERATION / C LIBRARIESFTGL can be built in various configurations (inspired by Freetype and libpng): - static library (.lib) - dynamic library (.dll) MSVC++ requires selection of "code generation" option, which seems to be mostly to do with which version of the Standard C library is linked with thelibrary. The following modes are supported: - static/dynamic - single threaded (ST) or multithreaded (MT)   NOTE: the multithreaded DLL (MD) mode was NOT included, as freetype itself         doesn't support that mode so I figure there's no point yet. - debug/release (debug has _d suffix) So the static multithreaded release library is:	ftgl_static_MT.lib	The same library built in DEBUG mode:	ftgl_static_MT_d.libIf you're not sure which one is appropriate (and if you're a novice don'tbeen too put off...) start with making the decision about debug or release.This should be easy because if you're building the debug version of your app its probably a good idea to link with the debug version of FTGL (butnot compulsory). Once thats done, you may get errors like:	LIBCMTD.lib(crt0init.obj) : warning LNK4098: defaultlib "libcmt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library This will happen, for example, when you link a glut app with an FTGL librarycompiled with different codegen options than the GLUT library. MSVC++ "sort of" requires that all libs be linked with the same codegen option. GLUT is builtin XXX mode, so if you're linking with GLUT, you can get rid of the warningby linking with the XXX version of FTGL. The various versions are particularlyuseful if you're doing std C stuff, like printf etc. FAQQ: "But... do I HAVE to use all these DIFFERENT build modes, like multi-   threaded, debug single threaded, etc?"   A: No. Sometimes library makers only generate one style anyway. It depends   on your needs. Unless you're linking with standard C stuff (e.g. printf)   then it probably won't make a great deal of difference. If you get    warnings about "default lib libcmt.lib conflicts" etc, then you can make   use of the different libraries.


So it looks like you can not use Dev-CPP, but I'm not 100% sure. Not only that the library files are different I believe.

- Drew
There we go.. lol I didn't think about using DevC++ to compile it lol. Stupid mee.

This topic is closed to new replies.

Advertisement