Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Help with linking

    Hi guys!!!
    I have 2 modules written in C language...... Module 1 uses the functions defined in module 2......
    I have compiled the module 1 files with the g++ -c option to generate an object file...... the module 2 files are compiled to produce a shared object file (.so) file which is in a different directory........
    I have written a make file to compile these files ........ But i am getting an error during the linking stage...... the files in the module 2 are not able to be linked to files in module 1......... I am getting an undefined reference error although the function is defined in module 2....
    My command line in the make file is
    g++ -lpthread -lMPAPI -Lmpmapi/linux -ldl -I.

    Please help me.....
    This is my first post..........

  2. #2
    If they are C files why are you using the C++ compiler ? In your command line what are MPAPI and mpmapi/linux ? Which object file are you trying to compile ? In your line I don't see any *.o file. If your line is only meant for linking the object files then I don't see why you use the -I option.

    If you only have 2 modules I suggest that you forget the make file for the time being and do everything from the beginning by hand.Post each step here along with the commands you used and any error messages you might get.

  3. #3
    There is some C++ code also in some files....
    Module 1 has around 34 C files and 5 header files
    Module 2 has 3 c Files
    In the command line there are around 34 object files.......
    I am not just linking , i am using g++ option to get executable...... But i am getting linking error......
    error:ld return status 1
    MPAPI is the .so file......
    and the location is in mpmapi/linux folder

  4. $spacer_open

Posting Permissions

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