Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: 1 [2]   Go Down

Author Topic: Get an error when I try to compile this(C++)  (Read 4981 times)

0 Members and 1 Guest are viewing this topic.
Re: Get an error when I try to compile this(C++)
« Reply #20 on: August 21, 2006, 08:54:58 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
Quote
It works fine in Dev-C++ but when I try to compile it in Microsoft Visual C++ 2005 proffesional edition I get errors. O____O
Are you sure you are not compiling under .NET, (VC++ 2005 can compile both native and IL executable images), as .NET has some quite significant changes.
I'm not compiling it under .NET
Logged

vroemer

Re: Get an error when I try to compile this(C++)
« Reply #21 on: August 21, 2006, 10:39:11 pm »
first I thought that the first lesson started you off with hello world... not that it matters

second Im using MS visual C++ 6 and your more recently posted source works fine with it...
Logged
Re: Get an error when I try to compile this(C++)
« Reply #22 on: August 22, 2006, 07:37:00 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
first I thought that the first lesson started you off with hello world... not that it matters

second Im using MS visual C++ 6 and your more recently posted source works fine with it...
Well I have version 8
Logged
Re: Get an error when I try to compile this(C++)
« Reply #23 on: August 22, 2006, 07:55:39 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
It works fine in Dev-C++ but when I try to compile it in Microsoft Visual C++ 2005 proffesional edition I get errors. O____O
iostream.h is depreciated use iostream.
You need to declare the namespace you wish to use. Put 'using namespace std' below your include statements..
Logged
Re: Get an error when I try to compile this(C++)
« Reply #24 on: August 22, 2006, 11:30:11 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
?
Logged
Re: Get an error when I try to compile this(C++)
« Reply #25 on: August 22, 2006, 11:32:38 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
?
He meant, you didn't follow my advice in your updated code.
Logged
Re: Get an error when I try to compile this(C++)
« Reply #26 on: August 22, 2006, 12:46:19 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
?
He meant, you didn't follow my advice in your updated code.
That wasn't the updated code I will always follow your advice. I just tried to compile the first code with Dev-C++ wich worked but doesn't work in Microsoft Visual C++ 2005!
Logged
Re: Get an error when I try to compile this(C++)
« Reply #27 on: August 22, 2006, 12:48:20 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
hum, I think I may know where the error occured, while putting 'using namespace std' below your include statements you did remember to add a semi-colon after it didn't you? Can you post your updated code please?
Logged
Re: Get an error when I try to compile this(C++)
« Reply #28 on: August 22, 2006, 12:51:53 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
Sure here it is.
Code: [Select]
//Oefening1: Klassen en objecten
#include <iostream>
namespace std
//De klassendeclaratie
class Breuk
{
private:
int teller,noemer;//Klasse-variablen

public:
void Ingeven();//Methoden
void Tonen();
};

//De klassedefinitie
void Breuk::Ingeven()
{
cout<<endl<<"Geef de waarden van teller en noemer:";
cin>>teller>>noemer;
}

void Breuk::Tonen()
{
cout<<endl<<"De breuk is :"<<teller<<"/"<<noemer<<endl;
}

//Het hoofdprogramma
int main()
{
Breuk B1;
B1.Ingeven();
B1.Tonen();
return 0;
}
Logged
Re: Get an error when I try to compile this(C++)
« Reply #29 on: August 22, 2006, 12:56:22 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
er, I said put "using namespace std" not "namespace std", a namespace declaration and a using declaration are totally different things, you also need to add a semi-colon after all statements in C++, including the using statement.
Logged

Ben

Re: Get an error when I try to compile this(C++)
« Reply #30 on: August 22, 2006, 12:56:51 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
"namespace std" needs to become "using namespace std;"

See if that works.

Oh you !@#$% Helios >_< don't be so damn quick.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: Get an error when I try to compile this(C++)
« Reply #31 on: August 22, 2006, 01:02:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6206
That did it thanks all for your help!
Logged
Pages: 1 [2]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.788 seconds with 59 queries.