LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-23-2004, 02:32 AM   #1
LavaDevil94
LQ Guru
 
Registered: Jul 2003
Distribution: Gentoo 2004.2: Who needs exmmpkg when you have emerge?
Posts: 1,795

Rep: Reputation: 47
Angry Strange /tmp error messages when compiling


I'm trying to compile this program to start off my entry into SDL:
Code:
#include </usr/include/SDL/SDL.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
  if ( SDL_Init(SDL_INIT_VIDEO) <0 ) {
    printf("Unable to init SDL: %s\n", SDL_GetError());
    return 1;
  }
  atexit(SDL_Quit);
}
But when I do, I get error messages like this:
Code:
/tmp/ccMdsGbg.o(xtest+0x16): In function `main':
: undefined reference to `SDL_Init'
/tmp/ccMdsGbg.o(xtest+0x16): In function `main':
: undefined reference to `SDL_GetError'
/tmp/ccMdsGbg.o(xtest+0x16): In function `main':
: undefined reference to `SDL_Quit'
collect2: ld returned 1 exit status
I can't gather any useful knowledge from these messages, but maybe you guys can?
 
Old 07-23-2004, 02:46 AM   #2
Kumar
Member
 
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
Try this -
cc sdl.c -lSDL -lpthread
 
Old 07-23-2004, 02:50 AM   #3
LavaDevil94
LQ Guru
 
Registered: Jul 2003
Distribution: Gentoo 2004.2: Who needs exmmpkg when you have emerge?
Posts: 1,795

Original Poster
Rep: Reputation: 47
It works ! Thanks Kumar, I've had this error for awhile, and now it's all gone!
Thanks again!
 
Old 07-23-2004, 02:52 AM   #4
Kumar
Member
 
Registered: Sep 2003
Location: Pune, India
Distribution: Red Hat
Posts: 106

Rep: Reputation: 15
well....actually you were missing the required libraries.
 
Old 07-23-2004, 05:26 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally posted by Kumar
Try this -
cc sdl.c -lSDL -lpthread
Better yet:

Change this line:
Code:
#include </usr/include/SDL/SDL.h>
to:
Code:
#include "SDL.h"
And then compile with:
Code:
gcc `sdl-config --cflags` `sdl-config --libs` -o sdlprog sdlprog.c
 
  


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
strange error messages when recompiling kernel. levicc00123 Slackware 8 12-21-2004 11:00 PM
strange missing _g_xxx error messages related to glib2 laimis Linux - Software 0 11-15-2004 07:09 AM
Origin of strange error messages when exiting KDE... migraine Linux - Newbie 3 06-06-2004 04:07 PM
Strange error messages on boot after swaret --upgrade swinchen Slackware 4 04-24-2004 12:49 PM
Help me with these strange error messages in my syslog, please. yuzuohong Linux - General 4 04-23-2003 03:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 PM.

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