Archived

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

RaistlinMajere

i need help

Recommended Posts

whenever i make a program and execute it (its bugless of course) i always get this error in any project when i run it: LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/dfdfsdfsfs.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. even if its just a program that outputs hello world. RAWRR!!! SOME ONE help me...this is driving my nuts... -thanks

Share this post


Link to post
Share on other sites
Make sure you typed "main" correctly, meaning the ''m'' is not capitalized, if you are doing this in a console app. If its a windows app make sure you type winmain with all smallcase. AFAIK thats the problem your having.

Share this post


Link to post
Share on other sites
try this source:

#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
cout<<"Hello, world"<<endl;
return 0;
}

if you want, you can post the source, and I can try to compile it on my machine.

[edited by - bastard2k5 on September 1, 2003 8:23:29 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by RaistlinMajere
i tried that source still doesnt work

Make sure the extension of the file is cpp and not h, or hpp or something like that. Otherwise your file most-likely will not even be compiled (hence the link error with main).

EDIT: Also, make sure you have the cpp file as a part of the project and not just opened in your IDE.

[edited by - Polymorphic OOP on September 1, 2003 10:35:55 PM]

Share this post


Link to post
Share on other sites
Are you building the app as a release or debug version?
Try debug, I think.
What API are you using?

-------------------------------
Anton Karlsson
Klingis Entertainment
Games with silly humor

Just dreaming wont make you (more) skilled in game programming/development.

Share this post


Link to post
Share on other sites
Jeeezzz i gotta save all u''r asses...

Did any ever think that maybee RaistlinMajere''s VC++ environment settings could be wrong, particulaly the path settings for lib and include files, these ARE GLOBAL TO EVERY PROJECT CREATED.

You may also have corrupted Lib files, bear in mind the console runtime library is an object compiled from asm NOT A LIBFILE with stubs to the various Api Dll''s.

It''s link.exe thats getting upset not the compiler, so you could also check that the action file (Of whatever Ms Calls them these days) is not getting corrupted during the build..


Try 2 compile your code outside the IDE from the command line eg...

C:\My Proj\>cl myprog.cpp

and optionaly

C:\My Prog\>link myprog.cpp kernel32.lib gdi32.lib user32.lib

and see what happens.

Alternitavely, reinstall visual studio and then try again..


and o

Share this post


Link to post
Share on other sites
Perhaps we can all get on the same page here. First of all, what IDE are you using? next, can you give us a set of steps that you do to get where you''re at?

The option to create a console app in VS.Net is kind of hidden away and you have to know how to get to it.

Share this post


Link to post
Share on other sites
If your getting linker errors when you try to run the program and not when you compile and build then there''s somthing REALLY WRONG, personally i think it may be an OS related error but i could be wrong...

Share this post


Link to post
Share on other sites