Sign in to follow this  
song6295

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 this post


Link to post
Share on other sites
Drew_Benton    1861
Quote:
Original post by song6295

when 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 point
int 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 this post


Link to post
Share on other sites
Drew_Benton    1861
Quote:
Original post by song6295
the 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.

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