G++ Can't Find Cstdlib (Fatal Error: Cstdlib: No Such File or Directory) [Closed]

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 conversion

in 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++/5

and 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 conversion

and

g++ -I /usr/include/c++/5.4.0 TestConversion.cpp -o conversion

which leads to the same result as above. I also tried

g++ -I /usr/include/c++/5.4.0/cstdlib  TestConversion.cpp -o conversion

which 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 conversion

produced

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.

You have mis-spelled the include name in your program. You have csdtlib and it should be cstdlib - the t and d are reversed.

1
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest