# Help with simple SDL program

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

## Recommended Posts

Hi, Im new to SDL and I was following this tutorial: http://pgdc.purdue.org/sdltutorial/sdl_setup.html And I tried to run their sample code. It compiled and ran OK (no errors), except that the "Hello SDL User!" it's not showing up. ¿Any clue?. Im using VS 2008, C++. Thanks in advance. Heres the code:
/* -- Include the precompiled libraries -- */
#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;
}



##### Share on other sites
SDL redirects all console output to stdout.txt

##### Share on other sites
As 39ster said, printf() doesn't draw text. printf() just writes text to a object called a 'stream', and that stream can be rerouted to different places.
In the Win32 Console you used to use (the black box with white text) printf() was rerouted to show the text on the console.
In SDL, print() is rerouted to a .txt file called 'stdout' that is created and placed in the same folder as your program.

To actually draw text in a actual graphical program, it takes a bit more work, and if you are new to SDL, I won't toss that information at you until you think you are ready for. Instead, it's so much easier (in SDL, anyway) to get a simple image to draw. Normally the first thing you do when learning SDL is drawing a picture that has the text 'Hello world' written on it manually in MSPaint (the paint program that comes with Windows)

I strongly suggest you to learn SDL through this tutorial, as it is very easy to understand compared to other tutorials, and helped me learn SDL easier. If you don't understand anything on that site, just ask, someone here will be glad to answer.

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 10
• 14
• 30
• 13
• 11
• ### Forum Statistics

• Total Topics
631782
• Total Posts
3002332
×