Quantcast

Maximum PC

It is currently Wed Jul 09, 2014 9:07 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Problems compiling C++
PostPosted: Mon Jul 11, 2005 10:46 am 
8086
8086

Joined: Wed Jul 14, 2004 2:26 pm
Posts: 25
Location: Great White North
Well I've started C++. I've tried 2 different compilers, Borland C++BuilderX personal edition and DevC++ and I get the same error messages when I try and compile my code. They tell me that certain files are missing, I've tried 2 different books but neither one of them point to this particular problem so I'm stuck. Here is my code and the error message form my last attempt. Can some one explain to me how I can correct the problem?

Code:
//Conversion - convert temperature from Celsius degree to Fahrenheit degree
units:
Fahrenheit = Celsius * (212 - 32)/100 + 32
#include <cstidio>
#include <csdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs[])

{
// 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 Cesius
// into Fahrenheit values
int nFahrenheit;
nFahrenheit = nFactor * nCelsius/100 + 32;

// output the results
cout << "Fahrenheit value is:";
cout << nFahrenheit;
cout << end1;

// wait until user is ready before terminating program
system("Pause");
return 0;


}


Errors;

4 c:\mydocu~1\c__com~1\tempco~1.cpp
cstidio: No such file or directory
5 c:\mydocu~1\c__com~1\tempco~1.cpp
csdlib: No such file or directory


Any ideas? :?

I've followed the books instructions to the letter and have rechecked my code severals times and can't see anything that I've done wrong. :cry:


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 10:49 am 
Klamath
Klamath

Joined: Tue Apr 05, 2005 12:06 pm
Posts: 253
Location: Deep in the heart of Texas!
Are you compiling from a command line or from some sort of IDE/GUI?


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 10:50 am 
Klamath
Klamath

Joined: Tue Apr 05, 2005 12:06 pm
Posts: 253
Location: Deep in the heart of Texas!
Nevermind. I think I see the problem.

Change:

Code:
#include <cstidio>
#include <csdlib>
#include <iostream>


To:

Code:
#include <cstidio.h>
#include <csdlib.h>
#include <iostream.h>


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 11:09 am 
8086
8086

Joined: Wed Jul 14, 2004 2:26 pm
Posts: 25
Location: Great White North
I tried that, sorry but the same error messages come up.

S3v3n11 wrote:
Are you compiling from a command line or from some sort of IDE/GUI?


I tried the "Console application" with the C++BuilderX IDE.

And the command line with the DevC++.

It makes no difference, that's why I'm a bit frustrated. I think that both authors neglected some basic instructions on setting up the compiler. :oops:


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 12:11 pm 
Klamath
Klamath

Joined: Tue Apr 05, 2005 12:06 pm
Posts: 253
Location: Deep in the heart of Texas!
It looks like it can't find the include files. Is there a setting somewhere to tell it where to look?


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 12:13 pm 
Klamath
Klamath

Joined: Tue Apr 05, 2005 12:06 pm
Posts: 253
Location: Deep in the heart of Texas!
Are those first three lines really three lines or just one line that wrapped?


Top
  Profile  
 
 Post subject:
PostPosted: Mon Jul 11, 2005 1:46 pm 
8086
8086

Joined: Wed Jul 14, 2004 2:26 pm
Posts: 25
Location: Great White North
Problem solved. I made a root directory in C: for those files. Then I copied and pasted the lesson onto another complier, for comparison purposes, and noticed that the font used in the book makes it difficult to tell the difference between a 1 and a l. I used the number when I should have used the letter. :P :oops:

Anyway thanks for the support and help. Very much appreciated, that ends about 5 days worth of frustation and banging my head against a wall. Fresh insight always helps, thanks again S3v3n11. :D

/ me goes off to do some more coding now that I've tasted success in C++. :D


Top
  Profile  
 
 Post subject:
PostPosted: Tue Jul 12, 2005 12:04 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
Problem: csdlib should be cstdlib and cstidio should be cstdio
S3v3n11: That's a horrible suggestion, sorry. You're suggesting he use a less-supported, old, deprecated set of headers that pollute the global namespace instead of using the new headers. NEVER use the standard library headers that end with .h because they aren't even part of the standard library -- they are only provided by some compilers for compatibility with really old C++ code.


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group