Don't you hate being a n00b?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

DJ Yoshi
Game Developer
Game Developer
Posts: 1021
Joined: Wed Mar 02, 2005 9:12 pm
Location: Madison, AL

Don't you hate being a n00b?

Post by DJ Yoshi »

Alright, so I'm trying to learn SDL via a book our friend GyroVorbis loaned to me, and I'm having a problem witht he second program, which is supposed to initialize a program that shows a blank screen.

Code: Select all

#include "sdl.h"
#include<stdio.h>
#include<stdlib.h>
SDL_Surface* g_pMainSurface = NULL;
SDL_Event g_Event;
int main(int argc, char *argv[])
{
	if(SDL_Init(SDL_INIT_VIDEO)==-1)
	{
		fprintf(stderr,"Could not initialize SDL!\n");
		exit(1);
	}
	else
	{
		fprintf(stdout,"SDL initialized properly!\n");
		atexit(SDL_Quit);
	}
	g_pMainSurface = SDL_SetVideoMode(640,480,0,SDL_ANYFORMAT);
	if(!g_pMainSurface)
	{
		fprintf(stderr,"Could not create main surface!\n");
		exit(1);
	}
	for(;;)
	{
		if(SDL_WaitEvent(&g_Event)==0)
		{
			fprintf(stderr,"Error while waiting for an event!\n");
			exit(1);
		}

		//check the type of event
		if(g_Event.type==SDL_QUIT)
		{
			fprintf(stdout,"Quit event has occurred.\n");
			break;
		}
	}
	fprintf(stdout,"Terminating program normally.\n");
	return(0);
}
Keeps giving me an "error executing links.exe". Any ideas why?

Thanks.

Visual C++ 6.0, by the way
Last edited by DJ Yoshi on Fri Mar 04, 2005 8:39 pm, edited 1 time in total.
There is no signature.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Have you gotten anything else to compile? I can look more in-depth at it, but it seems like the compiler would have alot more to bitch about if it were a real problem.

You said this was example 2 or something. Did the first one or any other example compile correctly?
DJ Yoshi
Game Developer
Game Developer
Posts: 1021
Joined: Wed Mar 02, 2005 9:12 pm
Location: Madison, AL

Post by DJ Yoshi »

The first one compiled fine...this one won't though.

:\
There is no signature.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

Its probably the fact that your using a subpar compiler.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

JS Lemming wrote:Its probably the fact that your using a subpar compiler.
Errr... excuse me? Whose the one that is using FREE dev C++? Just admit that you only hate VC++ because you don't have enough money to get it or have the resources to warez it.

Oh, and last I checked you were forced to dev on DC with VC++ because your other compiler is subpar.

PWNT! :spin:
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

GyroVorbis wrote:
JS Lemming wrote:Its probably the fact that your using a subpar compiler.
Errr... excuse me? Whose the one that is using FREE dev C++? Just admit that you only hate VC++ because you don't have enough money to get it or have the resources to warez it.

Oh, and last I checked you were forced to dev on DC with VC++ because your other compiler is subpar.

PWNT! :spin:
You wish you pwnt me! The fact the DevC++ is free and OPEN SOURCE means that a bunch of cool guru foos are makeing some friggen sweet software. I can't help the fact that the guy who made the DC developement kit preferred VC++. Given the chance, I'd pick DevC++ over VC++ anyday!
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
DJ Yoshi
Game Developer
Game Developer
Posts: 1021
Joined: Wed Mar 02, 2005 9:12 pm
Location: Madison, AL

Post by DJ Yoshi »

VC++ is a more powerful compiler ANY day of the week. Its tabbing system is about 100x better, its error messages are easier to read and more detailed, and its workspace is undeniably clean and easy to navigate.

Dev isn't BAD...but it's not as powerful by any means.

All the professionals use VC++. There's a reason ;)

But anyways, BACK TO THE PROBLEM AT HAND:

I've gotten it to compile...sorta. Now it spits out this error message:

Code: Select all

dl1.obj : error LNK2005: _SDL_main already defined in ein.obj
sdl1.obj : error LNK2005: "struct SDL_Surface * g_pMainSurface" (?g_pMainSurface@@3PAUSDL_Surface@@A) already defined in ein.obj
sdl1.obj : error LNK2005: "union SDL_Event g_Event" (?g_Event@@3TSDL_Event@@A) already defined in ein.obj
There is no signature.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

BWWUHAHAHA!!! You call that an easier to read error message!?!?! FOOL!.

You guys will wish you had thought otherwise when Bill Gates buys out Wall Mart and increases the price of toilet paper ten fold!!!!

Corn cob anyone?
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

JS Lemming wrote:BWWUHAHAHA!!! You call that an easier to read error message!?!?! FOOL!.

You guys will wish you had thought otherwise when Bill Gates buys out Wall Mart and increases the price of toilet paper ten fold!!!!

Corn cob anyone?
I wouldn't say that. More than once I've found DevC++ errors to be more than useless. VC++ has WAAAAY better error descriptions.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Could it possibly be that you have multiple source files in the same project file? That'd be my first guess.
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

GyroVorbis wrote: I wouldn't say that. More than once I've found DevC++ errors to be more than useless. VC++ has WAAAAY better error descriptions.
Believe whatever you want, its not like your wasting my time trying to figure out random messages.
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

JS Lemming wrote:
GyroVorbis wrote: I wouldn't say that. More than once I've found DevC++ errors to be more than useless. VC++ has WAAAAY better error descriptions.
Believe whatever you want, its not like your wasting my time trying to figure out random messages.
I'm busy believing that. Oh, and you're the one wasting your own time trying to figure out DevC++ error messages... :wink:
User avatar
JS Lemming
Game Developer
Game Developer
Posts: 2383
Joined: Fri May 21, 2004 4:09 pm
Location: C:\CON\CON

Post by JS Lemming »

You would be right if that were the case, but no, DevC++ error messages are comprehensive and too the point, and are actually readable.... matter'o'fact, I heard someone was going to make a book just out of the error messages, they are just that good. :mrgreen:
Small girl at the harbor wrote:Look Brandon, that crab's got ham!
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Post by Falco Girgis »

Hah, more like somebody is going to make a book on how to comprehend those terrible error messages.

Yes, they are that bad. :mrgreen:
quarn
Dreamcast Developer
Dreamcast Developer
Posts: 9
Joined: Wed Feb 02, 2005 10:33 am

Post by quarn »

You guys seem to confuse the compilers with the IDEs.

Also, the visual c++ toolkit 2003 (the core components, like the acctual compiler) is available for free at http://msdn.microsoft.com/visualc/vctoolkit2003/
and the Visual C++ 2005 Express Beta suite at http://lab.msdn.microsoft.com/express/v ... fault.aspx
Post Reply