Find the answer to your Linux question:
Results 1 to 5 of 5
hi.. im working on a socket API application that simulates concurrent server using fork()..anyway im trying to compile it using plain old gcc compiler: Code: gcc concFork.cpp -o conc and ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60

    error in socket based application

    hi..
    im working on a socket API application that simulates concurrent server using fork()..anyway im trying to compile it using plain old gcc compiler:
    Code:
    gcc concFork.cpp -o conc
    and this is the error im getting:
    Code:
    /tmp/ccm3Et4Z.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status
    any idea what the problem might be?

  2. #2
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60
    hello again
    i tried something different..i thought the problem was one of the socket library functions but it wasnt..
    i tried the following program:
    Code:
    #include <stdio.h>
    
    int main()
    {
    	printf("print something\n");
            return 0;
    }
    and the same error came out...so its something that has nothing to do with the sokcet library..so any ideas?

  3. #3
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Instead of the gcc command, try the g++ command.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  4. #4
    Just Joined!
    Join Date
    Oct 2007
    Posts
    60
    ya g++ worked..thanx..do u mean gcc is a C compiler and g++ is a cpp compiler?..

  5. #5
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    No. I tried your second program (the simple one) in a file with a .cpp extension using the gcc command, and the program ran without problems. The reason that I suggested using the g++ command is that I've seen people with a similar problem, and the suggestion came up to use g++, and it seemed to fix their problem (this problem that I apparently don't have).

    The gcc command typically runs a compiler, an assembler, and a linking loader. It's supposed to recognize from the extension (in this case, .cpp) whether the program is, say, C or C++. Based on that, it should cause the appropriate stuff (lots of it, much of which I don't understand) to happen.

    What's failing in your case is that each normal free-standing application (like your second program, the simple one) can't run with just the code you provide. There needs to be some preliminary setup before main() is called. This is previously compiled code which is installed with your C/C++ compilation stuff. There is one for C, and another for C++. My guess is that the linking loader loaded the wrong one, and failed because the proper external symbol was missing.

    Again, I didn't have this problem, and it could be a problem with how the C/C++ compilation stuff is configured/installed for your system.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

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