Im trying to compile the very simple c++ Program
//Programm, um Celcius in Fahrenheit umzurechnen
// F=C*(212-32)/100+32
#include <cstdio>
#include <csdtlib>
#include <iostream>
using namespace std;
int main(int numberofArgs, char*pszArgs[])
{
//Temperatur in C eingeben
int celcius;
cout<<"Geben Sie die Temperatur in Celcius ein: ";
cin>>celcius;
//Umrechnungsfaktor Berechnen
int factor;
factor=(212-32)/100;
//Umrechnen
int fahrenheit;
fahrenheit=celcius*factor-32;
//Ergebnis und Zeilenumbruch ausgeben
cout<<"entspricht in Fahrenheit: ";
cout<<fahrenheit<<endl;
//Warte bis Benutzer Ergebnis gelesen hat und Programm beendet
system("PAUSE");
return 0;
}after typing
g++ TestConversion.cpp -o conversionin the terminal, it returns
TestConversion.cpp:4:19: fatal error: csdtlib: No such file or directory
compilation terminated.in my system, cstdlib can be found in
/usr/include/c++/5and in
/usr/include/c++/5.4.0(5 and 5.4.0 are the only directories contained in /usr/include/c++)
therefore i have also tried
g++ -I /usr/include/c++/5 TestConversion.cpp -o conversionand
g++ -I /usr/include/c++/5.4.0 TestConversion.cpp -o conversionwhich leads to the same result as above. I also tried
g++ -I /usr/include/c++/5.4.0/cstdlib TestConversion.cpp -o conversionwhich probably makes no sense, since the result was
cc1plus: warning: /usr/include/c++/5.4.0/cstdlib: not a directory
TestConversion.cpp:4:19: fatal error: csdtlib: No such file or directory
compilation terminated(with the sme happening if 5.4.0 is replaced by 5).
I also installed clang to check if i could compile the program with it, but i had the same problem. The command
clang TestConversion.cpp -o conversionproduced
TestConversion.cpp:4:10: fatal error: 'csdtlib' file not found
#include <csdtlib> ^
1 error generated.I have already re-installed g++ and multilib.
I am using ubuntu 16.04 and have, as it may have become obvious, very little experience with programming and gcc/g++.
Any help would be greatly appreciated. I'll gladly provide any further details if they're useful.
1 Answer
You have mis-spelled the include name in your program. You have csdtlib and it should be cstdlib - the t and d are reversed.