Problem with SDL_Net

Is SDL_Net at work? I have problens when I try to execute, can anyone help me?
This is the code…
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_net.h>

using namespace std;

int main(int argc, char *argv[])
{
if(SDL_Init(0)==-1) {
printf(“SDL_Init: %s\n”, SDL_GetError());
exit(1);
}
if(SDLNet_Init()==-1) {
printf(“SDLNet_Init: %s\n”, SDLNet_GetError());
exit(2);
}
IPaddress google;
SDLNet_ResolveHost(&google,“www.google.com”,80);
SDLNet_Quit();
SDL_Quit();
system(“PAUSE”);
return 0;
}
The problem: "Cant execute C:…"
and "The windows can not execute this program becouse this is in a invalid
format"
Anyone know the problem?
(Ps.: excuse-me for my english)

Is SDL_Net at work? I have problens when I try to execute, can anyone help me?
This is the code…
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_net.h>

using namespace std;

int main(int argc, char *argv[])
{
if(SDL_Init(0)==-1) {
printf(“SDL_Init: %s\n”, SDL_GetError());
exit(1);
}
if(SDLNet_Init()==-1) {
printf(“SDLNet_Init: %s\n”, SDLNet_GetError());
exit(2);
}
IPaddress google;

The above does not look right. You need to declare variables at the
start of blocks.

    SDLNet_ResolveHost(&google,"www.google.com",80);
    SDLNet_Quit();
    SDL_Quit();
    system("PAUSE");
    return 0;

}
The problem: "Cant execute C:…"
and “The windows can not execute this program becouse this is in a invalid
format”

Sound like a build problem. Were there any errors during compiling or linking?
Have you built other SDL programs successfully with your environment?

Anyone know the problem?

See above.

ChrisOn 5/18/05, Daniel <rs.daniel at gmail.com> wrote:


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

> > int main(int argc, char *argv[]) > > { > > if(SDL_Init(0)==-1) { > > printf("SDL_Init: %s\n", SDL_GetError()); > > exit(1); > > } > > if(SDLNet_Init()==-1) { > > printf("SDLNet_Init: %s\n", SDLNet_GetError()); > > exit(2); > > } > > IPaddress google; > > The above does not look right. You need to declare variables at the > start of blocks.

Bleah, some C/C++ compilers allow this. Quite annoying when you go to
compile something with one that’s more strict. >:^P

<snip; back to Daniel>

The problem: "Cant execute C:…"
and “The windows can not execute this program becouse this is in a invalid
format”

Please tell me you weren’t trying to double-click the “.c” file, right? ;)On Sat, May 21, 2005 at 08:28:44PM -0500, Chris Nystrom wrote:

On 5/18/05, Daniel <rs.daniel at gmail.com> wrote:


-bill!
bill at newbreedsoftware.com
http://newbreedsoftware.com/

Bill Kendrick wrote:

The above does not look right. You need to declare variables at the
start of blocks.

Bleah, some C/C++ compilers allow this. Quite annoying when you go to
compile something with one that’s more strict. >:^P

since C99 this is valid C code - not really new. C++ never had this
restriction, AFAIK.

clemens

Daniel wrote:

Is SDL_Net at work? I have problens when I try to execute, can anyone help me?
This is the code…
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_net.h>

using namespace std;

int main(int argc, char *argv[])
{
if(SDL_Init(0)==-1) {
printf(“SDL_Init: %s\n”, SDL_GetError());
exit(1);
}
if(SDLNet_Init()==-1) {
printf(“SDLNet_Init: %s\n”, SDLNet_GetError());
exit(2);
}
IPaddress google;
SDLNet_ResolveHost(&google,“www.google.com”,80);
SDLNet_Quit();
SDL_Quit();
system(“PAUSE”);
return 0;
}
The problem: "Cant execute C:…"
and "The windows can not execute this program becouse this is in a invalid
format"
Anyone know the problem?
(Ps.: excuse-me for my english)

It might be the system(“PAUSE”) command that is your problem. Pause is not a
program, it is a function of command.com. It is also probably only available on
Windows. Try replacing it with some native C code, like:

printf(“Press any key to continue . . .\n”);
getchar();

You may have to inclde <stdio.h>

If that’s not it, then please post the entire error message that you’re seeing.

Ok, it is bad style then. :slight_smile:

ChrisOn 5/22/05, Clemens Kirchgatterer <clemens at 1541.org> wrote:

Bill Kendrick wrote:

The above does not look right. You need to declare variables at the
start of blocks.

Bleah, some C/C++ compilers allow this. Quite annoying when you go to
compile something with one that’s more strict. >:^P

since C99 this is valid C code - not really new. C++ never had this
restriction, AFAIK.


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

Heh, well, I’m a crusty old Debian user. I’m running a much newer GCC
these days, and I guess I just like to complain. ;^)

-bill!On Sun, May 22, 2005 at 07:33:13PM +0200, Clemens Kirchgatterer wrote:

since C99 this is valid C code - not really new. C++ never had this
restriction, AFAIK.