Sign in to follow this  
furin121

sdl and vc++ question

Recommended Posts

furin121    122
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
Boku San    428
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
furin121    122
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
Boku San    428
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
furin121    122
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this