iostream problem. Help! :P

This is a discussion on iostream problem. Help! :P within the C++ Programming forums, part of the General Programming Boards category; Hi, I just installed DJGPP with Rhide as IDE. When I tried to do a test program, I had an ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    2

    iostream problem. Help! :P

    Hi, I just installed DJGPP with Rhide as IDE.

    When I tried to do a test program, I had an error. The program I did is as follows:

    #include <iostream>

    int main()
    {
    using std::cout; // or using namespace std;
    cout << "Hello World";
    return 0;
    }

    The code above compiled with 0 errors but when it was creating the .exe file, it throws this error:

    Error: c:/djgpp/lib/gcc-lib/djgpp/3.1/libstdcxx.a(c++locale.o): In function 'void std::__convert_to_v<float>(char const*, float&, std::_Ios_Iostate&, int* const&, int)':
    c++locale.o(135) Error: undefined reference to '_finite'
    Error: collect 2: ld returned 1 exit status

    Anyone knows what it means? Thanks

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    Skyvoyager,

    Try placing 'using std::cout;' or 'using namespace std;' outside of main() - under the #include <iostream>.

    I'm not familiar with DJGPP but can guess that it's trying to compile 'using std::cout;' as part of the program with some rather bizarre results.

    -Skipper
    Last edited by skipper; 08-04-2002 at 06:35 AM.
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    2

    thanks

    Thanks skipper for your reply.

    I tried doing what you specified but I still get the same problem. Anyway, thanks for helping

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    Er, I have no idea what that error is trying to say but as far as I can tell that code should work

  5. #5
    Christian
    Join Date
    Mar 2002
    Posts
    618
    The code is fine as I compiled it.

    So the next two thing that it could be are:

    1. Your compiler is incorectly set up.
    2. DJGPP does not support using namespace std.
    I shall call egypt the harmless dragon

    -Isaiah 30.7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. IOSTREAM problem
    By joan in forum C++ Programming
    Replies: 13
    Last Post: 12-01-2006, 01:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21