Problem during linking

Hello,

My name is Smitha. I wanted to use SDL libraries to be able to create
graphics using gcc on cygwin.
I downloaded SDL-1.2.14. I have the source package and have already opened
the archive and installed the package.
I have a small piece of code using SDL with C to get me started with using
SDL. It is as shown below:

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

#define WIDTH 640
#define HEIGHT 480
#define DEPTH 32

*int main(int argc, char * argv[])
{
SDL_Surface screen;
SDL_Event event;

  • int keypress = 0;
    int h = 0;

if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
return 1;
}*

  • if(!(screen = SDL_SetVideoMode(WIDTH,HEIGHT,DEPTH,SDL_FULLSCREEN |
    SDL_HWSURFACE)))
    {
    SDL_Quit();
    return 1;
    }
    return 0;
    }*

I compiled and linked the code with the following command:

gcc sdl-config --cflags sdl-config --libs SDLTest.c

I get the following error:

/cygdrive/c/Users/smitha/AppData/Local/Temp/cc0XrJvy.o:SDLTest.c:(.text+0x4d):
undefined reference to '_SDL_SetVideoMode’
collect2: ld returned 1 exit status

output of command sdl-config --libs is:
-L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mno-cygwin -mwindows
output of command sdl-config --cflags is:
-I/usr/local/include/SDL -I/usr/include/mingw -mno-cygwin -Dmain=SDL_main
Please help.

Regards,
Smitha.

Hi,

try
gcc sdl-config --cflags SDLTest.c sdl-config --libs
. The order of the libraries is important, the compiler will search for
symbols only in the following libraries in the call.

Hello, ? My name is Smitha. I wanted to use SDL libraries to be able to
create graphics using gcc on cygwin. I downloaded SDL-1.2.14. I have the
source package and have already opened the archive and installed the
package. I have a small piece of code using SDL with C to get me started
with using SDL. It is as shown below: ? #include
#include #define WIDTH 640
#define HEIGHT 480
#define DEPTH 32 int main(int argc, char * argv[])
{
?SDL_Surface *screen;
?SDL_Event event; ?int keypress = 0;
?int h = 0;
?
?if(SDL_Init(SDL_INIT_VIDEO) < 0)
?{
??return 1;
?}
?if(!(screen = SDL_SetVideoMode(WIDTH,HEIGHT,DEPTH,SDL_FULLSCREEN |
SDL_HWSURFACE)))
?{
??SDL_Quit();
??return 1;
?}
?return 0;
} ? I compiled and linked the code with the following command: ? GCC
SDL-CONFIG --CFLAGS SDL-CONFIG --LIBS SDLTEST.C ? I get the
following error: ?

/cygdrive/c/Users/smitha/AppData/Local/Temp/cc0XrJvy.o:SDLTest.c:(.text+0x4d):On Tue, 22 Jun 2010 20:00:04 +1000, Smitha Rathnam <rathnam.smitha at gmail.com> wrote:

undefined reference to '_SDL_SetVideoMode’
collect2: ld returned 1 exit status ? output of command sdl-config --libs is: -L/USR/LOCAL/LIB -LMINGW32 -LSDLMAIN -LSDL -MNO-CYGWIN
-MWINDOWS
output of command sdl-config --cflags is: -I/USR/LOCAL/INCLUDE/SDL
-I/USR/INCLUDE/MINGW -MNO-CYGWIN -DMAIN=SDL_MAIN
Please help. ? Regards, Smitha. ?
?


Christoph Nelles

E-Mail : @Christoph_Nelles
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt

Hello,

Thanks for the solution. The linking goes through now.

Regards,
Smitha.On Tue, Jun 22, 2010 at 8:16 PM, Christoph Nelles wrote:

Hi,

try
gcc sdl-config --cflags SDLTest.c sdl-config --libs
. The order of the libraries is important, the compiler will search for
symbols only in the following libraries in the call.

On Tue, 22 Jun 2010 20:00:04 +1000, Smitha Rathnam <@Smitha_Rathnam> wrote:

Hello, My name is Smitha. I wanted to use SDL libraries to be able to
create graphics using gcc on cygwin. I downloaded SDL-1.2.14. I have the
source package and have already opened the archive and installed the
package. I have a small piece of code using SDL with C to get me started
with using SDL. It is as shown below: #include
#include #define WIDTH 640
#define HEIGHT 480
#define DEPTH 32 int main(int argc, char * argv[])
{
SDL_Surface *screen;
SDL_Event event; int keypress = 0;
int h = 0;

if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
return 1;
}
if(!(screen = SDL_SetVideoMode(WIDTH,HEIGHT,DEPTH,SDL_FULLSCREEN |
SDL_HWSURFACE)))
{
SDL_Quit();
return 1;
}
return 0;
} I compiled and linked the code with the following command: GCC
SDL-CONFIG --CFLAGS SDL-CONFIG --LIBS SDLTEST.C I get the
following error:

/cygdrive/c/Users/smitha/AppData/Local/Temp/cc0XrJvy.o:SDLTest.c:(.text+0x4d):

undefined reference to '_SDL_SetVideoMode’
collect2: ld returned 1 exit status output of command sdl-config --libs is: -L/USR/LOCAL/LIB -LMINGW32 -LSDLMAIN -LSDL -MNO-CYGWIN
-MWINDOWS
output of command sdl-config --cflags is: -I/USR/LOCAL/INCLUDE/SDL
-I/USR/INCLUDE/MINGW -MNO-CYGWIN -DMAIN=SDL_MAIN
Please help. Regards, Smitha.


Christoph Nelles

E-Mail : evilazrael at evilazrael.de
Jabber : eazrael at evilazrael.net ICQ : 78819723

PGP-Key : ID 0x424FB55B on subkeys.pgp.net
or http://evilazrael.net/pgp.txt


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