Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-07-2006, 10:23 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 20

Rep: Reputation: 0
my own tiny SDL program dumps a lot of symbols when it is run

OK, so I have started to learn SDL, and have made the following tiny, badly-structured program:

#include <stdio.h>
#include "SDL.h"

int main() {
	if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
		printf("Could not initialize SDL: %s\n", SDL_GetError());
  		return -1;
	printf("SDL initialized\n");

	SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, 0);
	if( !screen ) {
		printf("Couldn't open a window: %s\n", SDL_GetError());
		return -1;

	SDL_Surface* img = SDL_LoadBMP("image.bmp");

	if( !cubeimg ) {
		printf("Couldn't load the bitmap: %s\n", SDL_GetError());
		return -1;
	img = SDL_DisplayFormat(img);
	SDL_Rect * destrect;
	destrect->x = 200;
	destrect->y = 200;
	SDL_BlitSurface(img, NULL, screen, destrect);
	SDL_UpdateRect(screen, 0, 0, 640, 480);
	printf("Quitting SDL\n");
	return 0;
When I compile and run it, it works as expected, but things like
SDL initialized
     20778:     symbol=SDL_UpperBlit;  lookup in file=./a.out
     20778:     symbol=SDL_UpperBlit;  lookup in file=/usr/lib64/
     20778:     symbol=memcpy;  lookup in file=./a.out
     20778:     symbol=memcpy;  lookup in file=/usr/lib64/
     20778:     symbol=memcpy;  lookup in file=/lib64/tls/
     20778:     symbol=SDL_UpdateRect;  lookup in file=./a.out
appear. At the end of all the symbols, it shows this:
     20778:     symbol=__cxa_finalize;  lookup in file=/lib64/tls/
     20778:     runtime linker statistics:
     20778:                final number of relocations: 2296
     20778:     final number of relocations from cache: 1168
I don't think this has much to do with SDL, but more of my thinking like a .

Does anybody know why this is happening, and how to stop it?
I think it has something to do with the dynamic linker...

Thanks in advance...
Old 03-08-2006, 04:57 PM   #2
Senior Member
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
a guess at what may be a problem would be that you never allocate a SDL_Rect to use with your destrect ptr..
SDL_Rect * destrect;
destrect->x = 200;
destrect->y = 200;
just do it like this..
SDL_Rect destrect;
destrect.x = 200;
destrect.y = 200;
SDL_BlitSurface(img, NULL, screen, &destrect);
this may or may not have been the problem.. it wont compile as there are undeclared variables and such in it and i dont feel like fixing it to compile it..
Old 03-08-2006, 06:05 PM   #3
LQ Newbie
Registered: Jan 2005
Posts: 20

Original Poster
Rep: Reputation: 0
thx, now it works...i guess i should remember not to trust the default "random" addresses!

BTW, the documentation states that the blit function only looks at the x and y members of a rectangle (for the destination one). so it will compile.

Do you know why it outputs that junk though?

Last edited by kevman; 03-08-2006 at 06:06 PM. Reason: i don't like to show my signature


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compile a program with SDL RHLinuxGUY Programming 5 01-03-2006 12:12 AM
Looking for an IDE to program using SDL pujolasdf Linux - Software 2 04-02-2005 04:31 PM
Trying to program an SDL application but cannot find the SDL.h file:SuSE 9.2&KDevelop pujolasdf Linux - Newbie 4 03-13-2005 07:50 AM
Anyone gotten Homeworld SDL to run??? JaseP Linux - Games 4 09-27-2004 12:10 PM
Can I use a lot of decimals in my C program? Golradir Programming 14 07-04-2004 12:40 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:22 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration