# help:use sdl in vc++6

## Recommended Posts

song6295    122
i do as: http://sol.gfxile.net/gp/ch01_vc6.html but there is a error SDLmain.lib(SDL_win32_main.obj) : error LNK2001: unresolved external symbol _SDL_main

##### Share on other sites
song6295    122

when i chang 'int main()' to 'int main(int argc, char **argv)',that is ok

##### Share on other sites
Drew_Benton    1861
Quote:
 Original post by song6295when i chang 'int main()' to 'int main(int argc, char **argv)',that is ok

As the tutorial shows on page 2, but does not explain:
// Entry pointint main(int argc, char *argv[])

You MUST have that styled entry point for SDL to work properly, it's just the way it was made. That's why when you did not have the parameter list, it did not link properly, because internally SDL uses those parameters passed in.

##### Share on other sites
song6295    122
thank you
there is another problem
the ouput is in a text file,why?
and how can i input something
like:cin>>i;

##### Share on other sites
Drew_Benton    1861
Quote:
 Original post by song6295the ouput is in a text file,why?

Take a look at this thread for solving that problem, but what's in the text file? If it's an error message, it might because you are using fprintf to output there. Instead you will need to use cout or printf to get the display to the console. That shouldn't be a problem because in VC6, the streams should be set correctly.

As for being able to use 'cin', just have a #include <iostream> then you can add a using namespace std; It depends on where you want to get input, but going with tutorial 2, before the // Main loop: loop forever. you can add in a cin >> i; or whatever you want to do before hand to get input. You just have to be careful since you have an infinite loop for the SDL program.

## 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