GPWiki.org
GPWiki.org
It is currently Sun May 26, 2013 4:57 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Apr 21, 2009 2:32 pm 
Rookie

Joined: Tue Apr 21, 2009 2:23 pm
Posts: 2
Location: Istanbul, Turkey
Hi everyone, I'm new to here, and this is my first post, desperate for help.

I've downloaded and installed required SDL files, as explained in the wiki, http://gpwiki.org/index.php/SDL:Tutoria ... 2B.2B_.NET

When I include sdl.h under main, I get an error while debugging, which I totally do not understand. I have no idea what is wrong.



Code:
1>------ Build started: Project: RPG_GFX, Configuration: Debug Win32 ------
1>Linking...
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
1>C:\Users\Tarik\Desktop\My Custom Projects\RPG with GFX\RPG_GFX\Debug\RPG_GFX.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Tarik\Desktop\My Custom Projects\RPG with GFX\RPG_GFX\RPG_GFX\Debug\BuildLog.htm"
1>RPG_GFX - 2 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========




Again, I'm a starter to programming, and this is my first post here. Hopefully I'm posting at the right section, if not, I apologise. I'd be so glad if anyone could help me on this error, and in a rather simpler English as it's not my native langauge.

Thanks, and have a nice day.


Note: Using Visual Studio 2005, and the problem occurs on a Win32 Console Application.


Last edited by Driant on Tue Apr 21, 2009 3:55 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 21, 2009 3:13 pm 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
This should be under the C++ section. I'll move it for you :)

The issue could be one of 2 things. Either you haven't linked to the SDLmain.lib file in your project or you haven't named your main function correctly for an SDL project. For SDL, main should be one of the following:
Code:
int main(int argc, char*argv[])

int main(int argc, char**argv)


sdl.h will perform a rename of this function to SDL_main (or similar) so that it can do some pre-setup of SDL before actually getting to your main function, but it means you are required to have the correct signature (otherwise it can't find your main function and you get unresolved symbols like the one you have encountered :))

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 21, 2009 3:57 pm 
Rookie

Joined: Tue Apr 21, 2009 2:23 pm
Posts: 2
Location: Istanbul, Turkey
I renamed main function as you suggested, and now it works like a dream.

Didn't expect such a useful reply in such short time. Thank you very much workmad3!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group