Results 1 to 5 of 5

Thread: openSuse 11 and atoi() function

  1. #1
    kaoz70 NNTP User

    Default openSuse 11 and atoi() function

    Hi, ive ben trying to compile some C++ source code and have some problems with the atoi() function:

    Running make:

    Code:
    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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: openSuse 11 and atoi() function

    Code:
    #include <iostream>
    #include <stdlib.h>
    
    int main() {
            std::cout << atoi("42") << std::endl;
    }

  3. #3
    telebovich NNTP User

    Default Re: openSuse 11 and atoi() function

    I compiled this code in SuSE 10.3. It works good. Here is my code
    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.

  4. #4
    jsomers NNTP User

    Default Re: openSuse 11 and atoi() function

    Quote Originally Posted by telebovich View Post
    I compiled this code in SuSE 10.3. It works good. Here is my code
    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.
    <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>

  5. #5
    Join Date
    Jun 2008
    Location
    Talcahuano,Chile
    Posts
    58

    Exclamation Re: openSuse 11 and atoi() function

    Quote Originally Posted by kaoz70 View Post
    Hi, ive ben trying to compile some C++ source code and have some problems with the atoi() function:

    Running make:

    Code:
    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
    your program misses one

    Code:
    #include <cstdlib>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •