Archived

This topic is now archived and is closed to further replies.

ApparitionX

Compile Errors

Recommended Posts

ApparitionX    122
How am i suposed to learn C++ programming if all of the compilers i get give me these errors. I have tried to use both DJGPP and Dev-C++ and the same errors pop up. I have an xp comp it runs well ussually but so many errors could that be part of the error? Here is the programming code whats wrong with it? // // Conversion - convert temperature from Celsius // degree units into Fahrenheit degree units: // Fahrenheit = Celsius * (212 - 32)/100 + 32 // #include <stdio.h> #include <iostream.h> int main(int nNumberofArgs, char* pszArgs[]) { // enter the temperature in Celsius int nCelsius; cout << "Enter the temperature in Celsius:"; cin >> nCelsius; // calculate conversion factor for Celsius // to Fahrenheit int nFactor; nFactor = 212 - 32; // use conversion factor to convert Celsius // into Fahrenheit values int nFahrenheit; nFahrenheit = nFactor * nCelsius/100 + 32; // output the results cout << "Fahrenheit value is:"; cout << nFahrenheit; return 0; } When i hit compile the errors in the bottom pop up. C:\wecc\programs\Conversion.cpp [Warning] In function `int main(int, char**)': 10 C:\wecc\programs\Conversion.cpp `cout' undeclared (first use this function) 10 C:\wecc\programs\Conversion.cpp (Each undeclared identifier is reported 11 C:\wecc\programs\Conversion.cpp `cin' undeclared (first use this function) 16 C:\wecc\programs\Conversion.cpp `nfactor' undeclared (first use this 21 C:\wecc\programs\Conversion.cpp `nFactor' undeclared (first use this [edited by - ApparitionX on March 18, 2003 3:23:39 PM]

Share this post


Link to post
Share on other sites
ApparitionX    122
Now that i have tried to use differnet program have gotten more errors for this simple program.

#include <iostream.h>

int main ()
{
cout << "stupid piece of...";
return 0;
}

22 C:\Documents and Settings\Eric Viveiros\Desktop\Untitled1.cpp:1
iostream.h: No such file or directory.

C:\Documents and Settings\Eric Viveiros\Desktop\Untitled1.cpp
[Warning] In function `int:

5 C:\Documents and Settings\Eric Viveiros\Desktop\Untitled1.cpp
`cout''

5 C:\Documents and Settings\Eric Viveiros\Desktop\Untitled1.cpp
(Each

Share this post


Link to post
Share on other sites
olp-fan    122
Its not a problem with the code, its a problem with the compiler set up. Make sure you have the library and include directorys set in the compiler options.

Share this post


Link to post
Share on other sites
Sneftel    1788
1. When using the standard C++ libraries, you do not use the .h extension. Some (old and outdated) tutorials may refer to them like that, but it isn''t guaranteed to work anymore.

2. All of the standard library classes and functions are in the std namespace. You don''t need to care about namespaces yet; you just need to put "using namespace std;" after the #include line. Again, this is something that outdated tutorials might miss.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
ApparitionX    122
thanks for help but ive gotten totally confused the errors constantly change and ...... I think i need to take a break for a while im goin nuts trying to get the compilers setup... I installed Dev-C++ after installing it from the self install file I dont have to do anything else right? I think it was one of the bettas im not sure. I was totally sure I installed DJGPP correctly after it took a while to figure out how to do everything but i got it to work. so i have the programs opening up but i cant get rid of all the errors. "where can i find an up to date tutorial"? thats all i want to know because im going nuts becaue all i can find is stuff for windows 98 and i have an xp.

Share this post


Link to post
Share on other sites