How to run executable?

This is a discussion on How to run executable? within the C++ Programming forums, part of the General Programming Boards category; I'm on a UNIX system and have compiled my first program called "hello world". I named the binary code helloWorld ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    3

    Question How to run executable?

    I'm on a UNIX system and have compiled my first program called "hello world". I named the binary code helloWorld and get a file called helloWorld*. When I try to run it I get this message:

    ld.so.1: helloWorld: fatal: libstdc++.so.2.10.0: open failed: No such file or directory Killed

    The code compiled just fine; I used and 7-line example right out of a book, what gives?

  2. #2
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Were you using gcc? If so, tell us the exact syntax you used to compile it. I know gcc has a lot of flags and exceptions and you might have either compiled it to object code or some other type of format. I mess up UNIX flags all the time.

  3. #3
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    are you running it with the full path statement? If not... does your PATH statement reflect running binaries from the directory you are in...?
    Blue

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    3
    biosx -

    I'm using the 'c++' compiler on my system; this is the exact syntax,

    % c++ helloWorld.c -o helloWorld

    And again, it seems to create a binary executable in the /bin directory that looks like 'helloWorld*'.

    Betazap -

    Since I haven't explicitly stated any thing that resembles a 'path statement', I'm probably not running a full path statement, but just to be clear below is the source code.

    /****************************************

    Description:
    A small C++ program that says 'Hello, world!'

    ****************************************/

    // Various include files
    #include <iostream.h>

    int main ()
    {
    std::cout << "Hello, world!" << std::endl;
    return 0;
    }


    PS I don't think this should make a difference, but I'm on a Win2000 PC logged into a Sun Enterprise machine thru a telnet session, everything I'm doing is in the command line environment of UNIX to include the editor (vi).

    Cheers, Hugo

  5. #5
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    >PS I don't think this should make a difference, but I'm on a >Win2000 PC logged into a Sun Enterprise machine thru a telnet >session, everything I'm doing is in the command line >environment of UNIX to include the editor (vi).

    No, this shouldn't make a difference. The build environment is your Sun machine. That's the environment where compiling and linking is done.

    I could compile the source-code, used gpp. That's not the problem. The problem is linking

    >ld.so.1:

    If I am correct, ld is the linker. So this process encounters a fatal error and is being killed. And it seems that it cannot open a binary file called libstdc++.so.2.10.0 (?).

  6. #6
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    Check to see if there is a library called libstdc++.so.2.10.0 in /usr/lib or /usr/local/lib /lib and maybe a few other places. libstdc++.so usually is a soft link to the real library file, so make sure that libstdc++.so points to a valid file. You might also want to try a compile with g++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. calculating the mode
    By bigggame in forum C Programming
    Replies: 10
    Last Post: 06-13-2006, 03:04 AM
  2. How I can Run exe file in C++
    By palang in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2006, 11:55 AM
  3. Minimum Requirements fro Executable to Run?
    By thetinman in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2006, 06:05 AM
  4. MSVC: run w/o debugger vs run w/ debuger
    By skorman00 in forum C++ Programming
    Replies: 2
    Last Post: 01-24-2006, 08:49 PM
  5. Replies: 2
    Last Post: 10-29-2002, 03:56 PM

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