user
July 14, 2008, 1:53am
#1
Hi, ive ben trying to compile some C++ source code and have some problems with the atoi() function:
Running make:
error: ‘atoi’ was not declared in this scope
Is the atoi() function stashed in a strange header file, or perhaps the system doesn’t support it?
Any help would be much apreciated
#include <iostream>
#include <stdlib.h>
int main() {
std::cout << atoi("42") << std::endl;
}
user
July 15, 2008, 7:55pm
#3
I compiled this code in SuSE 10.3. It works good. Here is my code
#include <iostream>
#include <stdlib.h>
int main()
{ std::cout << atoi("45") << std::endl; return 0; }
P. S. Try to put in the end of main a return value.:rolleyes:
user
August 18, 2008, 10:08am
#4
I compiled this code in SuSE 10.3. It works good. Here is my code
#include <iostream>
#include <stdlib.h>
int main()
{ std::cout << atoi("45") << std::endl; return 0; }
P. S. Try to put in the end of main a return value.:rolleyes:
<nitpicking>main() is the only function where a return statement is not required. (Besides void functions.) The compiler should, according to the standard, foresee the return value 0.</nitpicking>