| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
In need of help with a simple program
This may sound stupid but this is my first time programing with C++ and I am trying a project out of a book. This is copied exactly as it is in the book but I get errors when building the .exe
Code:
// TrialRun.cpp
// Our First Program
#include <iostream>
using namespace std;
int main()
{
cout << "Some people think programming Windows"
<< endl
<< "is like nailing jello to the ceiling..."
<< endl
<< "easy with the right kind of nails."
<< endl << endl;
return 0;
}
This is the message I get from the output window. --------------------Configuration: TrialRun - Win32 Debug-------------------- Compiling... TrailRun.cpp Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/TrialRun.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. TrialRun.exe - 2 error(s), 0 warning(s) Does anyone know why this is happing? I can't figure it out. |
|
#2
|
|||
|
|||
|
Just type
#include <iostream.h> |
|
#3
|
|||
|
|||
|
Now I'm getting this:
--------------------Configuration: TrialRun - Win32 Debug-------------------- Compiling... TrailRun.cpp C:\Program Files\Microsoft Visual Studio\MyProjects\TrialRun\TrailRun.cpp(5) : error C2871: 'std' : does not exist or is not a namespace Error executing cl.exe. TrialRun.exe - 1 error(s), 0 warning(s) |
|
#4
|
||||
|
||||
|
Well, Jaf
I would check your compiler, I copied and pasted the exact text into my compiler, Microsoft Visual Studio 2005 and it compiled fine with no errors!! |
|
#5
|
||||
|
||||
|
Yeah, what compiler are you using? And do you have it set to build a console app (as apposed to a GUI)?
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips. ![]() |
|
#6
|
|||
|
|||
|
Well this linker error results in sometimes when the linker cannot locate the libraries.
Have you set the "LIB" environment variable? The installation sets this by default, but sometimes you may need to set this to include all the libs. ----- Programming (Assignment/Project) Help |
|
#7
|
|||
|
|||
|
I am using visual c++ 6.0. Someone sugested that it might be a problem with .net, that maybe I don't have it installed correctly. Geo.Garentt, what compiler are you using?
|
|
#8
|
|||
|
|||
|
Quote:
I'd say it's a compiler problem. B-Con recommended Dev-Cpp and I don't get the error with that. |
|
#9
|
||||
|
||||
|
I use Visual Studio 2005 beta.
|
|
#10
|
|||
|
|||
|
Quote:
I'm waiting for my copy to come. Hopefully that will work for me. I'll try out dev-cpp also. Thanks for the help. |
|
#11
|
||||
|
||||
|
Ya I havent used any others, well atleast not any others that I could under stand. I used a version called C+ Borland? That was before I got my beta copy. Well you'll enjoy it, makes life a lot easier thats for sure. -- and -- I dont know much but if I can ever help feel free to ask...
![]() |
|
#12
|
|||
|
|||
|
Quote:
Thanks a lot. just one quesiton though, is there a time limit on how long you can use the beta? If so how long is it? |
|
#13
|
||||
|
||||
|
Ya, you get an entire year to use it, plus they expect you to comment on how it worked for you. Which isnt a problem Im sure.
|
|
#14
|
|||
|
|||
|
That's awesome becasue after a year they'll be ready to beta test 2006
![]() |
|
#15
|
||||
|
||||
|
--true true--
![]() |
|
#16
|
|||
|
|||
|
hopefully I'll have a dvd rom driver by then...I didn't expect to need to upgrade my pc for 2005 lmao
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > In need of help with a simple program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|