Jump to content
  • Advertisement
Sign in to follow this  
furin121

sdl and vc++ question

This topic is 4698 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, here's my silly newb question of the night. I found this code in some SDL documentation for sdl + vc++:
#ifdef WIN32
#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#endif

#include "SDL.h"

int main(int argc, char **argv)
{
	printf("\nHello SDL User!\n");

	/* initialize SDL */
	if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
	{
		fprintf( stderr, "Video initialization failed: %s\n",
			SDL_GetError( ) );
		SDL_Quit( );
	}
	
	SDL_Quit( );

	return 0;
}

now, according to the tutorial this should just print the "hello sdl user" comment to the screen. However, when I run it it shows nothing on the screen. I also noticed that it creates a file named stdout.txt with the "hello sdl user" text in it. Any idea why it's doing this?

Share this post


Link to post
Share on other sites
Advertisement
SDL redirects stdout (written to by printf()) output to a file called stdout.txt.

This is normal. Drew_Benton should be here momentarily to inform you of details of the redirection (I don't have much experience with SDL) -- he usually is, anyway.

Share this post


Link to post
Share on other sites
so apparently that's normal output.. now i have to wonder why the tutorial had a screenshot showing it would output to the command line? ah well, guess I'll just fool around some more or something.. thanks bro

Share this post


Link to post
Share on other sites
My experience with SDL is, as I mentioned, limited -- but have you tried setting the project to a console file (instead of a win32 or SDL app)?

Might be a good place to start -- or you could just hit [google] up for an answer.

Share this post


Link to post
Share on other sites
yeah, i was in the process of trying it as a plain consol app and got distracted by another tutorial.. ran down that rabbit trail.. got some kind of funky screesaver looking thing going right now.. trying to figure out exactly what the code is doing (site said it was a tutorial, but more like a cut and paste and figure out type project) :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!