#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;
}
sdl and vc++ question
Ok, here's my silly newb question of the night. I found this code in some SDL documentation for sdl + vc++:
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?
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.
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.
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
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.
Might be a good place to start -- or you could just hit [google] up for an answer.
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) :)
"printf(...)" doesn't print to the console for me either. The way I print to the console is "fprintf(stdout, ...);" =)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement