DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

Basic Programming Error Help
Page 1 of 1
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Joshua
DieHard SS
DieHard SS


Joined: 15 Mar 2012
Last Visit: 5:24 ago.

Topics: 192
Posts: 461

usa.gif

PostPosted: Sat Sep 15, 2018 7:37 pm
   Subject: Basic Programming Error Help
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

#include <iostream>
using namespace std ;
int main()
{
cout << “Hello!” << endl ;
return 0 ;
}


program.cpp: In function 'int main()':
program.cpp:5:10: error: 'Hello' was not declared in this scope
cout << "Hello!" << endl ;

I am having problems with this basic C++ program now. It use to compile correctly in MingW compiler using CMD Prompt. Now it doesn't. How do I correct this situation?
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:18 ago.

Topics: 165
Posts: 8281
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat Sep 15, 2018 8:12 pm
   Subject: Re: Basic Programming Error Help
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm not sure why you're using the "<< endl" parameter here. I think putting in "\n" right after the "!" would work better instead, such as this:
::: CODE :::
cout << “Hello!\n";

This page will tell you more about what you're dealing with involving the "cout" command.
Joshua
DieHard SS
DieHard SS


Joined: 15 Mar 2012
Last Visit: 5:24 ago.

Topics: 192
Posts: 461

usa.gif

PostPosted: Sat Sep 15, 2018 8:26 pm
   Subject: Re: Basic Programming Error Help
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The C++ book that I got uses the endl parameter. This is why I am using it. The program is not compiling because of something on my end I guess. Not sure what. I compiled it using cmd prompt and MingW. I just uninstalled everything related the MingW and am planning on installing it later.
AlumiuN
DieHard Wolfer
DieHard Wolfer


Joined: 29 Nov 2007
Last Visit: 5:13 ago.

Topics: 38
Posts: 2517
Location: Christchurch, New Zealand
newzealand.gif

PostPosted: Sun Sep 16, 2018 12:27 am
   Subject: Re: Basic Programming Error Help
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

I believe the problem here is that you've used the wrong quote characters around the Hello!. You should only use the normal quotes ("), but if the copied code is accurate you used different ones (“ and ”). The difference is subtle to human readers but very important to the compiler.

As an additional point, I'd recommend not including the line "using namespace std;" and instead changing the cout line to:

::: CODE :::
std::cout << "Hello!" << std::endl;


Including the whole std namespace is at best a bad idea and at worst may actually break things. Note that if the C++ book you has makes a habit of using that, you may need to figure out what needs the 'std::' placed onto the start of it (in general anything that you haven't declared in the code you've written will probably need it).
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [help] Adding teleporters in wolf4sdl
Author: Mortimer
35 12227 Fri May 26, 2017 8:19 am
Military View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 3243 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [Wolf4SDL Help] Inserting a second palette (like in SoD)
Author: Andy_Nonymous
10 3662 Mon Jun 02, 2008 3:59 pm
Adam Biser View latest post
No new posts [Help] Problem with Checkweaponchange function (wolf4sdl)
Author: Mortimer
4 3478 Sat May 17, 2008 11:26 am
Mortimer View latest post
No new posts [help] Wolf4sdl's implemented tutorials
Author: Mortimer
6 3613 Tue May 06, 2008 1:15 pm
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group