C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 7th, 2005, 08:15 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old July 8th, 2005, 07:30 PM
nishivision nishivision is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 12 nishivision User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 58 sec
Reputation Power: 0
Arrow Here is ur reply

Just type

#include <iostream.h>

Reply With Quote
  #3  
Old July 8th, 2005, 08:42 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
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)

Reply With Quote
  #4  
Old July 13th, 2005, 12:13 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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!!

Reply With Quote
  #5  
Old July 13th, 2005, 12:46 AM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 8 m 6 sec
Reputation Power: 4
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.



Reply With Quote
  #6  
Old July 13th, 2005, 05:55 AM
proghelper proghelper is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 12 proghelper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 46 m 21 sec
Reputation Power: 0
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

Reply With Quote
  #7  
Old July 13th, 2005, 10:30 AM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
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?

Reply With Quote
  #8  
Old July 13th, 2005, 10:54 AM
Empath Empath is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 12 Empath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 12 m 9 sec
Reputation Power: 0
Quote:
Originally Posted by jaf1211
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)
I have the same problem if I try to use 'using namespace std;' in Visual C++ 6.0

I'd say it's a compiler problem. B-Con recommended Dev-Cpp and I don't get the error with that.

Reply With Quote
  #9  
Old July 13th, 2005, 11:36 AM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
I use Visual Studio 2005 beta.

Reply With Quote
  #10  
Old July 13th, 2005, 04:35 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
Quote:
Originally Posted by Geo.Garnett
I use Visual Studio 2005 beta.


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.

Reply With Quote
  #11  
Old July 13th, 2005, 04:42 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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...

Reply With Quote
  #12  
Old July 13th, 2005, 04:55 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
Quote:
Originally Posted by Geo.Garnett
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...


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?

Reply With Quote
  #13  
Old July 13th, 2005, 06:03 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
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.

Reply With Quote
  #14  
Old July 13th, 2005, 07:54 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
That's awesome becasue after a year they'll be ready to beta test 2006

Reply With Quote
  #15  
Old July 13th, 2005, 08:16 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
--true true--

Reply With Quote
  #16  
Old July 14th, 2005, 08:23 PM
jaf1211 jaf1211 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 21 jaf1211 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 28 m 15 sec
Reputation Power: 0
hopefully I'll have a dvd rom driver by then...I didn't expect to need to upgrade my pc for 2005 lmao

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > In need of help with a simple program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump