Archived

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

Linking problem...

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a quickie question: I decided to continue with my c++ learning now that school is back and what not, so I decided to refresh myself by reading an old tutorial. Well, within 30 seconds of programming, I have a problem which I cannot fix, grr. Here is the code: ----------------------------- #include <iostream> using namespace std; int main() { cout << "testing"; return 0; } ------------------------------ And this is what i get: ------------------------------ Compiling... prac.cpp C:\Program Files\Microsoft Visual Studio\MyProjects\Prac\Prac.cpp(7) : warning C4508: ''main'' : function should return a value; ''void'' return type assumed Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/Record.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Record.exe - 2 error(s), 1 warning(s) ----------------------------- Any help would be nice!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That''s not it. The code is correct, you need to set up your compiler to compile a "console program" or something like that. Otherwise it will try to find a function called WinMain instead of main.

Share this post


Link to post
Share on other sites
*Thinks to himself all the vulgarities this topic is worth of, and decides to play Mr. Nice Guy just one more time...*

Okay kiddo, try this. Go to Project->Settings->Link->Project Options (editbox at the bottom)-> change "/subsystem:windows" to "/subsystem:console".

Fair warning: I will never answer this question again in any sort of way remotely mistakable for patient or kind.

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

Share this post


Link to post
Share on other sites
Thanks, but now I have another question, why won''t this work:
--------
cout << "Just kidding"
--------
Hehe, I said that I just started again...I like obscenities anyway!
Thanks for the help, though.

Share this post


Link to post
Share on other sites
quote:
Original post by Heza64
Thanks, but now I have another question, why won't this work:
--------
cout << "Just kidding"
--------
Hehe, I said that I just started again...I like obscenities anyway!
Thanks for the help, though.


umm well for one thing you forgot the semicolon at the end lol

lol i don't know if your kidding or not but don't think i'm stupid its just 7:15 AM here....

--------------------signature--------------------

Looking for usefull, interesting resources

WELL DONT LOOK HERE>>http://www.dragonruins.com/

but its still fun to have a look around

[edited by - Smacker_626 on August 27, 2002 7:27:09 AM]

Share this post


Link to post
Share on other sites
Oh and even though i didn''t come here for ansewers but thanks for that info ZealousElixir and Mr Anonymous ive been having that problem for ever.

But I just got rid of it by loading the .cpp file and building a new workspace

--------------------signature--------------------

Looking for usefull, interesting resources

WELL DONT LOOK HERE>>http://www.dragonruins.com/

but its still fun to have a look around

Share this post


Link to post
Share on other sites