LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-22-2005, 04:27 AM   #1
godice
LQ Newbie
 
Registered: May 2005
Posts: 3

Rep: Reputation: 0
Unhappy Cannot compile SDL apps


after creating a simple SDL Application for learning purposes.
GCC wouldn't let me away with this.
it gave me a bunch of compiler errors.

here is my simple SDL source code:

Code:
#include<SDL/SDL.h>
#include<stdio.h>
#include<stdlib.h>

int main()
{
	SDL_Surface *screen;

	/* Initiliaze SDL's Video system and check for errors. */
	if (SDL_Init(SDL_INIT_VIDEO) != 0) {
		printf("Unable to initialize SDL: %s\n", SDL_GetError());
		return 1;
	}

	/* Make sure that SDL exits when the program exits.*/

	atexit(SDL_Quit);

	/* attempt to make a 640 X 480 hiColor Mode. */
	screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);
	if (screen == NULL) {
		printf("Unable to set video mode: %s\n", SDL_GetError());
		return 1;
	}

	/* als alles is gelukt */
	printf("SDL has bin successfully loaded.\n");

}
And this is how I tried to compile the code:
gcc main.c -o gametest -I/usr/include/SDL -D_REENTRANT -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread

I also tried this:
gcc main.c -lSDL -o test

And this:
gcc main.c -o gametest `sdl-config --cflags --libs`

and nothing worked.
I keep getting these errors:

......
..........
(a view other thousand error messages here...)
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x122c): In function `SDL_XDGAGetViewportStatus':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x12e3): In function `SDL_XDGASync':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1320): In function `SDL_XDGASync':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1344): In function `SDL_XDGASync':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x140b): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1454): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1474): In function `SDL_XDGAChangePixmapMode':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1560): In function `SDL_XDGACreateColormap':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x158c): In function `SDL_XDGACreateColormap':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x16f2): In function `SDL_XDGACloseFramebuffer':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1775): In function `SDL_XDGACloseFramebuffer':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x199a): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XReply'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x19e0): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `XMissingExtension'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1a72): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XRead'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA2.o)(.text+0x1a94): In function `SDL_XDGAOpenFramebuffer':
: undefined reference to `_XFlush'
/usr/lib/gcc-lib/i586-suse-linux/3.3.4/../../../libSDL.a(XF86DGA.o)(.text+0x114): In function `SDL_XF86DGAGetVideoLL':
..............
(and here)


This is probably a linkingphase error.
but how to fix it?
Is there a library I'm missing?

Last edited by godice; 05-22-2005 at 06:49 AM.
 
Old 05-22-2005, 08:18 AM   #2
godice
LQ Newbie
 
Registered: May 2005
Posts: 3

Original Poster
Rep: Reputation: 0
ok, nevermind..
I fixed the the problem, Suse gave me an evil SDL Library, so I just reinstalled it.
thanks to the people that were planning to help me.
 
Old 05-22-2005, 08:34 AM   #3
Cyborg16
LQ Newbie
 
Registered: Feb 2005
Distribution: Debian "Sarge" testing
Posts: 19

Rep: Reputation: 0
Some things work wierdly - I had a linker error with SDL and OpenGL, which I resolved by linking the GLU library (GL was linked before). And the errors were for standard GL functions, when no GLU functions were used (not by me anyway - I don't know if SDL uses them for window initialisation). Anyone know why?? (I'm also pretty sure it used to compile and link without, maybe an upgrade caused it).
 
  


Reply


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
sdl style apps mouse jumps every 5sec (fluxbox tested) netsurf SUSE / openSUSE 0 11-26-2005 07:27 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
What is a good IDE or such that will compile SDL? blufire Programming 3 03-07-2005 02:17 AM
3D apps hang at SDL initialized onchiman Linux - Software 3 04-13-2004 09:18 AM
SDL apps running awfuly slow Oxyd Linux - Software 1 12-14-2003 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 AM.

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