Advertisement

unresolved external symbol _main

Started by February 02, 2002 09:18 PM
8 comments, last by apit 23 years ago
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...
apit
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.

Advertisement
how can i recreate my program.. i mean from Win32 Console Application to Win32 Application..can u guide me..i''m using visual c++
apit
"_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.
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.
Did you include all of the .lib etc... before compiling? Check the first NeHe tut for the .lib you need to include.

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



sad isn''t it?

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.

Advertisement
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).
also, if you are doing a GL app (I assume you are) then you will need to add the lib files again.
Press "Alt-F7"

"Link" tab

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

========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
tq all for your concern....
apit

This topic is closed to new replies.

Advertisement