SDL_net dev cpp linker problem

Hello there!

I’m trying to compile a small program which I’ve written and uses SDL and
SDL_net.

Problem is, that I get a couple of these: [Linker error] undefined
reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker, besides
from -lSDL?

Can’t figure this out, and the documentation provides no help for compiling
using windows.

/Chris–
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d? s-: a— C>$ UL+++>$ P L+++>$ !E— !W+++>$ !N o? K–? !w-- !O----
!M>$ !V? PS+(+++)@ !PE Y++ !PGP? t++ !5? X++ !R tv–? b+>$ DI D+ G e h !r
!y*
------END GEEK CODE BLOCK------

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL library.
Therefore, you need to specify it when you are linking. This goes for the
other SDL_??? libraries (e.g. SDL_ttf).

AlvinOn Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Hello there!

I’m trying to compile a small program which I’ve written and uses SDL and
SDL_net.

Problem is, that I get a couple of these: [Linker error] undefined
reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker, besides
from -lSDL?

Can’t figure this out, and the documentation provides no help for compiling
using windows.

Right, that’s just as I thought then, however, do I need to compile the
SDL_net library myself to be able to link with it?

/ChrisOn 5/4/07, Alvin wrote:

On Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Hello there!

I’m trying to compile a small program which I’ve written and uses SDL
and
SDL_net.

Problem is, that I get a couple of these: [Linker error] undefined
reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker,
besides
from -lSDL?

Can’t figure this out, and the documentation provides no help for
compiling
using windows.

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL library.
Therefore, you need to specify it when you are linking. This goes for the
other SDL_??? libraries (e.g. SDL_ttf).

Alvin


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


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d? s-: a— C>$ UL+++>$ P L+++>$ !E— !W+++>$ !N o? K–? !w-- !O----
!M>$ !V? PS+(+++)@ !PE Y++ !PGP? t++ !5? X++ !R tv–? b+>$ DI D+ G e h !r
!y*
------END GEEK CODE BLOCK------

Since you are getting linker errors and not compile errors, I bet you already
have SDL_net installed. In that case, just add the -lSDL_net linker option
and those errors should go away.

AlvinOn Friday 04 May 2007 09:23:55 Chris Rajula wrote:

On 5/4/07, Alvin <@Alvin_Beach> wrote:

On Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Problem is, that I get a couple of these: [Linker error] undefined
reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker,
besides from -lSDL?

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL library.
Therefore, you need to specify it when you are linking. This goes for the
other SDL_??? libraries (e.g. SDL_ttf).

Right, that’s just as I thought then, however, do I need to compile the
SDL_net library myself to be able to link with it?

I have downloaded the SDL_net library, but I have no idea of how to
"install" it.
I’m a regular Linux user, and I’m working in a Windows environment. I’m
totally confused.

The SDL_net library only comes in source code.
I’ve tried to compile the library, but it gives me strange errors, like
[Linker error] undefined reference to `WSAStartup at 8’ .

/ChrisOn 5/4/07, Alvin wrote:

On Friday 04 May 2007 09:23:55 Chris Rajula wrote:

On 5/4/07, Alvin wrote:

On Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Problem is, that I get a couple of these: [Linker error] undefined
reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker,
besides from -lSDL?

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL library.
Therefore, you need to specify it when you are linking. This goes for
the

other SDL_??? libraries (e.g. SDL_ttf).

Right, that’s just as I thought then, however, do I need to compile the
SDL_net library myself to be able to link with it?

Since you are getting linker errors and not compile errors, I bet you
already
have SDL_net installed. In that case, just add the -lSDL_net linker option
and those errors should go away.

Alvin


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


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d? s-: a— C>$ UL+++>$ P L+++>$ !E— !W+++>$ !N o? K–? !w-- !O----
!M>$ !V? PS+(+++)@ !PE Y++ !PGP? t++ !5? X++ !R tv–? b+>$ DI D+ G e h !r
!y*
------END GEEK CODE BLOCK------

Have you just tried adding -lSDL_net after -lSDL in your compiler command
line?

To help further I need more details of your system so I can point you at the
right places. At the very least, what Linux distribution are you using?

AlvinOn Friday 04 May 2007 09:43:45 Chris Rajula wrote:

On 5/4/07, Alvin <@Alvin_Beach> wrote:

On Friday 04 May 2007 09:23:55 Chris Rajula wrote:

On 5/4/07, Alvin <@Alvin_Beach> wrote:

On Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Problem is, that I get a couple of these: [Linker error]
undefined reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the compiler/linker,
besides from -lSDL?

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL
library. Therefore, you need to specify it when you are linking. This
goes for

the

other SDL_??? libraries (e.g. SDL_ttf).

Right, that’s just as I thought then, however, do I need to compile the
SDL_net library myself to be able to link with it?

Since you are getting linker errors and not compile errors, I bet you
already
have SDL_net installed. In that case, just add the -lSDL_net linker
option and those errors should go away.

Alvin

I have downloaded the SDL_net library, but I have no idea of how to
"install" it.
I’m a regular Linux user, and I’m working in a Windows environment. I’m
totally confused.

The SDL_net library only comes in source code.
I’ve tried to compile the library, but it gives me strange errors, like
[Linker error] undefined reference to `WSAStartup at 8’ .

Oh, I had just forgotten to download the SDL_net devel package.
I did just that, and installed it.

It seems to work now, except for a small problem, but I don’t think it’s SDL
related.
I now get the following [Linker error] undefined reference to `WinMain at 16’
.

Thing is, I never use WinMain :s

Any ideas?

/ChrisOn 5/4/07, Alvin wrote:

On Friday 04 May 2007 09:43:45 Chris Rajula wrote:

On 5/4/07, Alvin wrote:

On Friday 04 May 2007 09:23:55 Chris Rajula wrote:

On 5/4/07, Alvin wrote:

On Friday 04 May 2007 08:58:37 Chris Rajula wrote:

Problem is, that I get a couple of these: [Linker error]
undefined reference to `SDLNet_TCP_Recv’
Are there any special flags I should give to the
compiler/linker,

besides from -lSDL?

-lSDL_net :wink:

SDL_net is an addon library - it’s not a part of the core SDL
library. Therefore, you need to specify it when you are linking.
This

goes for

the

other SDL_??? libraries (e.g. SDL_ttf).

Right, that’s just as I thought then, however, do I need to compile
the

SDL_net library myself to be able to link with it?

Since you are getting linker errors and not compile errors, I bet you
already
have SDL_net installed. In that case, just add the -lSDL_net linker
option and those errors should go away.

Alvin

I have downloaded the SDL_net library, but I have no idea of how to
"install" it.
I’m a regular Linux user, and I’m working in a Windows environment. I’m
totally confused.

The SDL_net library only comes in source code.
I’ve tried to compile the library, but it gives me strange errors, like
[Linker error] undefined reference to `WSAStartup at 8’ .

Have you just tried adding -lSDL_net after -lSDL in your compiler command
line?

To help further I need more details of your system so I can point you at
the
right places. At the very least, what Linux distribution are you using?

Alvin


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


-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d? s-: a— C>$ UL+++>$ P L+++>$ !E— !W+++>$ !N o? K–? !w-- !O----
!M>$ !V? PS+(+++)@ !PE Y++ !PGP? t++ !5? X++ !R tv–? b+>$ DI D+ G e h !r
!y*
------END GEEK CODE BLOCK------

IIRC, you need to add 2 additional libraries for main() compatibility.
You don’t use WinMain(), but SDL/Windows does.

Your linker settings should look something like this (assuming there
are no other dependencies). The order in which you link is important
(note, this is from memory, so change the order if you are having
trouble). Look in path/to/dev-cpp/lib if it complains that some of
these are missing, in case I misspelled them ( I think SDLmain doesn’t
have an underscore, but I could easily be wrong)

-lmingw32
-lSDLmain
-lSDL
-lSDL_net

Cheers,

  Brian.On 5/4/07, Chris Rajula <superrajula at gmail.com> wrote:

It seems to work now, except for a small problem, but I don’t think it’s SDL
related.
I now get the following [Linker error] undefined reference to `WinMain at 16’