Linking problem...

Started by
8 comments, last by Heza64 21 years, 7 months ago
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!
::Thinks to himself: console, console, console...:: -Heza
Advertisement
You forgot the .h in
That''s what I thought too, but I tried it either way and get the same error.
::Thinks to himself: console, console, console...:: -Heza
Try creating your project as a Console application, and then just copy the code into it. Don''t forget to include

" Do we need us? "


Ionware Productions - Games and Game Tools Development

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.
quote:Original post by Noods
You forgot the .h in <iostream.h>
There is no .h in <iostream>.
*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

[twitter]warrenm[/twitter]

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.
::Thinks to himself: console, console, console...:: -Heza
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]
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

This topic is closed to new replies.

Advertisement