• Popular Now

• 11
• 9
• 10
• 9
• 10

Archived

This topic is now archived and is closed to further replies.

unresolved external symbol _main

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

Recommended Posts

i''m having problem running most of my download program in visual c++....when i compile the program , an error message appear...it said "unresolved external symbol _main"...program that i take from NeHe tutorials also having the same problem..i don''t have problem running the *.exe file but when i run the c++ source file the problem appear...please help me...

Share on other sites
It''s now official: no one knows how to use search engines or GameDev''s search feature.

Recreate your project as a Win32 Application, not a Win32 Console Application.

Share on other sites
how can i recreate my program.. i mean from Win32 Console Application to Win32 Application..can u guide me..i''m using visual c++

Share on other sites
"_main" is the function that is called by "Windows" to start your program. so to build your executable you need to have a function named "main". the leading " _ " is prepended to all c functions; so don''t worry about that.

i.e.

  int main(int argc, char **args){ // do whatever. return (0);}

hope this helps.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share on other sites
Did you include all of the .lib etc... before compiling? Check the first NeHe tut for the .lib you need to include.

Zoinks!

Share on other sites
quote:
Original post by Null and Void
It''s now official: no one knows how to use search engines or GameDev''s search feature.

apit: This question has been asked, under different titles 100s of times. I''m not saying there is anything wrong but next time try searching the forums and probably google first. Lots of newbies get teased for not searching.

Share on other sites
In Windows the entry point of a Console Application is ''main'' and in a Windowed Application it is WinMain, so if you have code containing a WinMain function you should create a Window Application project for it.

Just select ''New'' in the menu, go to the ''Project'' tab and select a ''Win32 Application'', write a name for it and select a folder in which to create the project.

Then click on the "File View" tab in the project view and right click on the project name in the tree-view. Click ''Add Files to Project'' and select all the files you want in the project (you might first want to copy all relevant files to the project directory to keep things in one place).

It should now compile correctly (assuming the code is correct).

Share on other sites
also, if you are doing a GL app (I assume you are) then you will need to add the lib files again.

Share on other sites
Press "Alt-F7"

Change "subsystem:windows" by "subsystem:console"

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/