I realize this is probably not the most appropriate place to ask something like this, but I've spent far too much time searching for the answer, and I figure someone here might be able to help.

---------

So I have recently been introduced to programming with OpenGL and glut in on of my CS classes. It's all well and good, except for the fact that rendering fonts is more or less impossible with it. I did some searching and found FreeType, and then later FTGL, and downloaded them both.

After many problems, I finally got MSVC++ to build ftgl_static_MT.lib (a static, multi-threaded library for FTGL). I am now attempting to build an application that makes use of this. I placed a copy of the .lib file in c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib, and in the project I am developing I went to Project -> Properties -> Linker -> Input, and added "ftgl_static_MT.lib" to the "Additional Dependencies" field.

I run the application, and it can not find any of the objects (or other code) declared in FTGL (specfically, FTGLPixmapFont).

So is there just something else I need to do to get it to find / include the .lib file? Or is it more serious than that?

I would say the DROD forum is the best place to ask about anything at all
Not that I have a solution for you. I've had troubles getting everything to link fine in the past too though. I presume you're including the correct header files, but what precisely do you mean by 'cannot find'? Is it a linker error or something else?

I'm not exactly sure. The only errors it gives me are the ones related to it not being able to find the FTGL code (which is supposedly in the .lib).

However, I did some experimenting: if I comment out the code that uses FTGL, it compiles and runs fine (which is good, I guess). Then, if I replace FTGL_static_MT.lib with something that obviously doesn't exist (something like alsdkhg.lib), it complains about the .lib file not existing (also good, I guess). However, if I un-comment the FTGL code, leaving the non-existant .lib, it complains about the same errors as before (regarding the FTGL classes not existing). Therefore, it seems it's not even getting to the .lib before it decides the classes don't exist. However, it also means it's finding the .lib (which is one good thing, I guess).

quote:TripleM wrote:
I presume you're including the correct header files

That is likely the problem. However, I do not know what header(s) I need to include. The output of building FTGL was only the .lib file. Right now, the only header I have included is glut.h.

I did find a FTGL.h in the FTGL directory (which I would imagine is the intuitive file to include), but including that doesn't seem to change anything. I also tried including the FTGLPixmapFont.h header file. This seems to be closer to working, but then it complains about exit(int) being declared with __declspec(noreturn) and defined without (in stdlib.h, which must've been included by FreeType or FTGL). Does anyone know what this means / how I might go about fixing it?

quote:Kevin_P86 wrote:
I placed a copy of the .lib file in c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib, and in the project I am developing I went to Project -> Properties -> Linker -> Input, and added "ftgl_static_MT.lib" to the "Additional Dependencies" field.

Ugh... don't do that - don't add files to the Visual Studio installation directory, that's a rather big no-no.

Rather, add the directory that your .lib-file is in to your project's library path, and add the path with the FTGL header files (which are already included with the source) to your project's include path.

Also, if you really want to get useful help - why don't you just post the error messages exactly like you get them in Visual Studio's output window?

Yeah, I agree about the copying and pasting of error messages, thats the best thing to do.
But not including the right headers would be the main problem. This doesn't look very well documented at all, but I suggest you try out some of the sample code in the /demo folder for FTGL (assuming you downloaded it from the same source I did; [url http://homepages.paradise.net.nz/henryj/code/index.html.

Hopefully you should be able to get that to work, and it should give you an idea of what headers you'll need.

After that, if you've still got the exit problem, try posting that error message and we'll see what happens.

A function was declared and then defined but the definition used the noreturn __declspec modifier. The use of noreturn constitutes a redefinition of the function; the declaration and definition need to agree on the use of noreturn.

Rather, add the directory that your .lib-file is in to your project's library path, and add the path with the FTGL header files (which are already included with the source) to your project's include path.

I have added the FTGL headers to the include path (and therefore was also required to add the FT headers, because FTGL includes some of the FT headers). But I don't know where to find the library path. All I can find is the Additional Dependencies I mentioned before, and it doesn't look like that wants directories.

quote:TripleM wrote:
doesn't look very well documented at all, but I suggest you try out some of the sample code in the /demo folder for FTGL

I have looked at some of those, but it looks like all they did was include the FTGL headers they used. When I tried that, it couldn't find the corresponding .cpp files (which are in a different directory).

Ouch. That means that the include files you're including define the "exit" function more than once - you might want to grep your included files for other instances of "exit" and work around that. I'm afraid I can't give you specific help without having your drive in hand...

Rather, add the directory that your .lib-file is in to your project's library path, and add the path with the FTGL header files (which are already included with the source) to your project's include path.

I have added the FTGL headers to the include path (and therefore was also required to add the FT headers, because FTGL includes some of the FT headers). But I don't know where to find the library path. All I can find is the Additional Dependencies I mentioned before, and it doesn't look like that wants directories.

In Visual Studio 2005, that's "Configuration Properties > Linker > General > Additional Library Directories", which is a single line of text with a button that opens some directory list widget. I don't have VS.Net here, so it might be slightly different on your end...

quote:Briareos wrote:
Ouch. That means that the include files you're including define the "exit" function more than once - you might want to grep your included files for other instances of "exit" and work around that. I'm afraid I can't give you specific help without having your drive in hand...

I searched the entire FT and FTGL solutions (all header and source files) for "exit(", and all 12 that it found were just calling the function, not declaring / defining it.

Edit: And when I just search for "exit" (with no parenthesis), the only extra ones it finds are a whole bunch of "Exit:" labels, and the corresponding "goto Exit;" lines.

quote:Briareos wrote:
In Visual Studio 2005, that's "Configuration Properties > Linker > General > Additional Library Directories", which is a single line of text with a button that opens some directory list widget. I don't have VS.Net here, so it might be slightly different on your end...

So I did some more searching. I searched through all the standard include files being included (i.e. <iostream>, <string>, <math.h>, and a few others) as well as all files they included, and no occurences of "exit" anywhere.

I then searched through all the source files of FreeType and FTGL, and found the following lines in \src\gzip\zutil.c in the FreeType directory:

#ifndef STDC
extern void exit OF((int));
#endif

Does anyone know enough to tell me if that could possibly be the problem? Although if it is the problem, it certainly doesn't help. And if it is not the problem, then I have even less of an idea as to what the problem is than I did before (if that is possible).

This problem was fixed by simply including <stdlib.h> (which defines exit(int) ) in main.cpp...

However, now I have a more general problem.

1) I compiled the FTGL project into FTGL_static_MT.lib, which is located at C:\Progs\FTGL\win32_vcpp\build\FTGL_static_MT.lib

2) In the current project (the one in which I wish to use this .lib), I went to Properties -> Linker -> General, and added "C:\Progs\FTGL\win32_vcpp\build" to the "Additional Library Directories" field.

which is politely letting me know it can't find the FTGLPixmapFont(const char*) constructor (there are two others similar errors, politely letting me know it can't find the two other functions I call either).