Linkage error

This is a discussion on Linkage error within the C Programming forums, part of the General Programming Boards category; Hi, I am writing a C program using MPI for parallelization. Following is the script I use to compile and ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    16

    Linkage error

    Hi,
    I am writing a C program using MPI for parallelization. Following is the script I use to compile and run the code:-


    clear
    make veryclean
    mpicc -c -I ./include -O -o two.o ComputeFPE_QP_GQ.c
    c++ -I ./include -O -L ./lib -o two.exe two.o -looqpgensparse -looqpsparse -looqpgendense -looqpdense -looqpgondzio -looqpbase -lm -llapack -lblas -lgsl -lgslcblas ./examples/QpGen/cinterface/libg2c.a ./extras/MA27/libMA27.a ./extras/blas/libblas.a
    ./two.exe

    I get following error dhen I run the script:-
    Undefined reference to MPI_Init.

    As it is clear from the script, I am using C++ compiler after I compile my C code using mpicc. This is because many of the libraries I am trying to link require c++ compiler.
    I have written another very simple C program using mpi. It compiles and runs smoothly.
    Could anyone tell me what could be the problem with compiler in the given script??

    Thanks

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    You're going to need to add the MPI libraries as options when you compile, I would suspect.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

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