G++ problem

Compiling and build was ok week ago but now. This errors comes to me even I try
to use g++ same way that earlier. Where is problem? I am not so familiar with
the Linux (ubuntu) that I would understand these.
/usr/local/include/SDL/SDL_ttf.h:33:17: error: SDL.h: No such file or directory
/usr/local/include/SDL/SDL_ttf.h:34:24: error: begin_code.h: No such file or
directory
/usr/local/include/SDL/SDL_ttf.h:232:24: error: close_code.h: No such file or
directory

Specify the path for SDL
If you have pkg-config installed you can include the following command in
your compile command

g++ test.cpp pkg-config --cflags --libs 'sdl'

Or otherwise use something like this

g++ test.cpp -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -lSDL

-Abhinav–
Fred Allen - “Television is a medium because anything well done is rare.”

On Fri, Jul 11, 2008 at 3:36 PM, Preacher wrote:

Compiling and build was ok week ago but now. This errors comes to me even I
try
to use g++ same way that earlier. Where is problem? I am not so familiar
with
the Linux (ubuntu) that I would understand these.
/usr/local/include/SDL/SDL_ttf.h:33:17: error: SDL.h: No such file or
directory
/usr/local/include/SDL/SDL_ttf.h:34:24: error: begin_code.h: No such file
or
directory
/usr/local/include/SDL/SDL_ttf.h:232:24: error: close_code.h: No such file
or
directory


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks but no help:)

this is situation now… I am confused… I am trying to learn lazy foo’s
tutorials so thats why “lessons”…

]$ g++ lesson07.cpp pkg-config --cflags --libs 'sdl'
/tmp/ccb8Tmc7.o: In function clean_up()': lesson07.cpp:(.text+0x29): undefined reference toTTF_CloseFont’
lesson07.cpp:(.text+0x2e): undefined reference to TTF_Quit' /tmp/ccb8Tmc7.o: In functioninit()’:
lesson07.cpp:(.text+0x9b): undefined reference to TTF_Init' /tmp/ccb8Tmc7.o: In functionload_image(std::basic_string<char,
std::char_traits, std::allocator >)’:
lesson07.cpp:(.text+0x12b): undefined reference to IMG_Load' /tmp/ccb8Tmc7.o: In functionload_files()’:
lesson07.cpp:(.text+0x214): undefined reference to TTF_OpenFont' /tmp/ccb8Tmc7.o: In functionmain’:
lesson07.cpp:(.text+0x2d2): undefined reference to `TTF_RenderText_Solid’
collect2: ld returned 1 exit status

How do I do it that I can use just handles like -lSDL_ttf again?

-Preacher

Hello !

/usr/local/include/SDL/SDL_ttf.h:33:17: error: SDL.h: No such file
or directory
/usr/local/include/SDL/SDL_ttf.h:34:24: error: begin_code.h: No such file or
directory
/usr/local/include/SDL/SDL_ttf.h:232:24: error: close_code.h: No such file or
directory

Is SDL actualy installed ? You can check with
dpkg -l |less
and look there for libsdl1.2 and libsdl1.2-dev

CU

Hello !

Thanks but no help:)

this is situation now… I am confused… I am trying to learn lazy foo’s
tutorials so thats why “lessons”…

]$ g++ lesson07.cpp pkg-config --cflags --libs 'sdl'
/tmp/ccb8Tmc7.o: In function clean_up()': lesson07.cpp:(.text+0x29): undefined reference toTTF_CloseFont’
lesson07.cpp:(.text+0x2e): undefined reference to TTF_Quit' /tmp/ccb8Tmc7.o: In functioninit()’:
lesson07.cpp:(.text+0x9b): undefined reference to TTF_Init' /tmp/ccb8Tmc7.o: In functionload_image(std::basic_string<char,
std::char_traits, std::allocator >)’:
lesson07.cpp:(.text+0x12b): undefined reference to IMG_Load' /tmp/ccb8Tmc7.o: In functionload_files()’:
lesson07.cpp:(.text+0x214): undefined reference to TTF_OpenFont' /tmp/ccb8Tmc7.o: In functionmain’:
lesson07.cpp:(.text+0x2d2): undefined reference to `TTF_RenderText_Solid’
collect2: ld returned 1 exit status

What is the way that you installed SDL ? Compiled all the sourcecode yourself
or installed the libs from the ubuntu repository ?

CU

El Viernes 11 Julio 2008ES 12:42:11 Preacher escribi?:

How do I do it that I can use just handles like -lSDL_ttf again?

You can keep adding switches to the command line in order to specify all the
libraries you want:

g++ lesson07.cpp pkg-config --cflags --libs 'sdl' -lSDL_ttf -lSDL_image

Torsten Giebl <wizard syntheticsw.com> writes:

Hello !

/usr/local/include/SDL/SDL_ttf.h:33:17: error: SDL.h: No such file
or directory
/usr/local/include/SDL/SDL_ttf.h:34:24: error: begin_code.h: No such file or
directory
/usr/local/include/SDL/SDL_ttf.h:232:24: error: close_code.h: No such file or
directory

Is SDL actualy installed ? You can check with
dpkg -l |less
and look there for libsdl1.2 and libsdl1.2-dev

CU

I used synaptic for the installation first time and I reinstalled it using
source codes.
"./configure"
make
make install
Those I used to install sources.
All compiling without libsdl_ttf working but when I use ttf it won’t.

-Preacher

Alberto Luaces <aluaces udc.es> writes:

El Viernes 11 Julio 2008ES 12:42:11 Preacher escribi?:

How do I do it that I can use just handles like -lSDL_ttf again?

You can keep adding switches to the command line in order to specify all the
libraries you want:

g++ lesson07.cpp pkg-config --cflags --libs 'sdl' -lSDL_ttf -lSDL_image

Hey, THANK YOU A LOT!!! FOR ALL OF YOU!!

g++ -Wall -o lesson14 lesson14.cpp pkg-config --cflags --libs 'sdl'
-lSDL -lSDL_ttf -lSDL_image

This is working. Am I right that pkg-config just finds the paths of files but it
doesn’t have effect to compiling itself?

-Preacher

Hello !

I used synaptic for the installation first time and I reinstalled it using
source codes.
"./configure"
make
make install
Those I used to install sources.
All compiling without libsdl_ttf working but when I use ttf it won’t.

Did you delete all the installed sdl packages before
installing from source ? If not, this might cause problems.

CU

El Viernes 11 Julio 2008ES 13:01:05 Preacher escribi?:

This is working. Am I right that pkg-config just finds the paths of files
but it doesn’t have effect to compiling itself?

Glad you got it working :slight_smile:

Well, it adjusts the paths and some compiler configuration options and specify
the SDL library, as you can see if you execute the command without the ``,
but you still need to include external SDL libraries like SDL_TTF and
SDL_image, which were causing the errors you sent.