Problems compiling SDL Applications using SDL_ttf

I am using Visual C++ 6.0 and I am unable to compile any applications using
SDL_ttf. I recieve the following errors:

q:\sdl\sdl_ttf\sdl_ttf.h(61) : error C2143: syntax error : missing '{'
before 'const’
q:\sdl\sdl_ttf\sdl_ttf.h(61) : error C2143: syntax error : missing '{'
before '*'
q:\sdl\sdl_ttf\sdl_ttf.h(61) : error C2061: syntax error :
identifier 'TTF_Linked_Version’
q:\sdl\sdl_ttf\sdl_ttf.h(61) : error C2059: syntax error : ';'
q:\sdl\sdl_ttf\sdl_ttf.h(61) : error C2059: syntax error : 'type’
q:\sdl\sdl_ttf\sdl_ttf.h(71) : error C2054: expected ‘(’ to follow 'DECLSPEC’
q:\sdl\sdl_ttf\sdl_ttf.h(71) : error C2085: ‘SDLCALL’ : not in formal
parameter list
q:\sdl\sdl_ttf\sdl_ttf.h(71) : error C2146: syntax error : missing ‘,’ before
identifier 'TTF_ByteSwappedUNICODE’
q:\sdl\sdl_ttf\sdl_ttf.h(71) : error C2143: syntax error : missing ';'
before '('
q:\sdl\sdl_ttf\sdl_ttf.h(71) : error C2059: syntax error : ')'
q:\sdl\sdl_ttf\sdl_ttf.h(77) : error C2054: expected ‘(’ to follow 'DECLSPEC’
q:\sdl\sdl_ttf\sdl_ttf.h(77) : error C2085: ‘SDLCALL’ : not in formal
parameter list
q:\sdl\sdl_ttf\sdl_ttf.h(77) : error C2146: syntax error : missing ‘,’ before
identifier 'TTF_Init’
q:\sdl\sdl_ttf\sdl_ttf.h(77) : error C2143: syntax error : missing ';'
before '('
q:\sdl\sdl_ttf\sdl_ttf.h(77) : error C2059: syntax error : ')'
q:\sdl\sdl_ttf\sdl_ttf.h(83) : error C2054: expected ‘(’ to follow 'DECLSPEC’
q:\sdl\sdl_ttf\sdl_ttf.h(83) : error C2085: ‘SDLCALL’ : not in formal
parameter list
q:\sdl\sdl_ttf\sdl_ttf.h(83) : error C2146: syntax error : missing ‘,’ before
identifier 'TTF_OpenFont’
q:\sdl\sdl_ttf\sdl_ttf.h(83) : error C2143: syntax error : missing ';'
before '('
q:\sdl\sdl_ttf\sdl_ttf.h(83) : error C2059: syntax error : ')'
q:\sdl\sdl_ttf\sdl_ttf.h(84) : error C2054: expected ‘(’ to follow 'DECLSPEC’
q:\sdl\sdl_ttf\sdl_ttf.h(84) : error C2085: ‘SDLCALL’ : not in formal
parameter list
q:\sdl\sdl_ttf\sdl_ttf.h(84) : error C2146: syntax error : missing ‘,’ before
identifier 'TTF_OpenFontIndex’
q:\sdl\sdl_ttf\sdl_ttf.h(84) : error C2143: syntax error : missing ';'
before '('
q:\sdl\sdl_ttf\sdl_ttf.h(84) : error C2059: syntax error : ')'
q:\sdl\sdl_ttf\sdl_ttf.h(85) : error C2054: expected ‘(’ to follow 'DECLSPEC’
q:\sdl\sdl_ttf\sdl_ttf.h(85) : error C2085: ‘SDLCALL’ : not in formal
parameter list
q:\sdl\sdl_ttf\sdl_ttf.h(85) : error C2146: syntax error : missing ‘,’ before
identifier 'TTF_OpenFontRW’
q:\sdl\sdl_ttf\sdl_ttf.h(85) : error C2143: syntax error : missing ';'
before '('
q:\sdl\sdl_ttf\sdl_ttf.h(85) : error C2059: syntax error : ')'
etc…etc…

Now all these are due to the extern function. I am not sure what exactly th
eproblem is besides the fact either MSVC++ does not like the definitions, or
it does not like the definitions because it won’t go into C style definitions.
I would fix this myself but I lack the skill and familiarity with SDL_ttf.
Does anyone have any answers? Thanks for the help.

(I am actually trying to compile the source from the Super Mario Clone and
that requires SDL_ttf. Somehow it compiles fine for them.)

Nathaniel Husted

I downloaded SMC FX 0.811 from smclone.sf.net and built it with Visual C++ 6.0.

I have the following binary development packages:

SDL 1.2.7
SDL_image 1.2.3
SDL_mixer 1.2.5a
SDL_ttf 2.0.6

Your error messages indicate a missing define, or something. The
preprocessor should replace the DECLSPEC and SDLCALL symbols with
__declspec(dllimport) and __cdecl, respectively.

At 06:00 PM 3/4/2004 +0000, Nathaniel Husted wrote:

I am using Visual C++ 6.0 and I am unable to compile any applications using
SDL_ttf. I recieve the following errors:

…>Now all these are due to the extern function. I am not sure what exactly th

eproblem is besides the fact either MSVC++ does not like the definitions, or
it does not like the definitions because it won’t go into C style
definitions.
I would fix this myself but I lack the skill and familiarity with SDL_ttf.
Does anyone have any answers? Thanks for the help.

(I am actually trying to compile the source from the Super Mario Clone and
that requires SDL_ttf. Somehow it compiles fine for them.)

Jon Willeke <willeke users.sourceforge.net> writes:

I downloaded SMC FX 0.811 from smclone.sf.net and built it with Visual C++
6.0.

I have the following binary development packages:

SDL 1.2.7
SDL_image 1.2.3
SDL_mixer 1.2.5a
SDL_ttf 2.0.6

Well, I just downloaded the developer versions of all four libraries and
SDL_ttf still gives me the same errors. Here is how the project is set up:

I included all the .lib files to the SMC FX project, and then changed
the ‘Additional Include Directories’ so all .h files would be found properly.
Alas, this did not solve my problems. I still recieve problems with the
sdl_ttf. I also noticed that the begin_code.h file that SDL_ttf includes is
empty. Is that usual? Am I forgetting anything? Thanks.

Sorry for the delayed reply; I only just received this message today.

All I can say is that the Visual C++ IDE can be very confusing. Double
check that you’ve set the options for the configuration you’re building. I
don’t know that it will help, but I’ll send you my project files.

Here’s a simpler program with which to test your configuration:

#include “SDL.h”
#include “SDL_ttf.h”
#include <stdlib.h>

int
main( int argc, char *argv[] )
{
SDL_Init( 0 );
atexit( SDL_Quit );
TTF_Init();
atexit( TTF_Quit );

return 0;
}

I build it with Visual C++ 6.0 using a command line not entirely unlike the
following:

C:>cl /MD /Ic:\sdl\include ttftest.cpp sdl.lib sdlmain.lib sdl_ttf.lib
/link /libpath:c:\sdl\lib /subsystem:console

At 06:17 PM 3/5/2004 +0000, Nathaniel Husted wrote:>Well, I just downloaded the developer versions of all four libraries and

SDL_ttf still gives me the same errors. Here is how the project is set up:

I included all the .lib files to the SMC FX project, and then changed
the ‘Additional Include Directories’ so all .h files would be found properly.
Alas, this did not solve my problems. I still recieve problems with the
sdl_ttf. I also noticed that the begin_code.h file that SDL_ttf includes is
empty. Is that usual? Am I forgetting anything? Thanks.