problem with compiling code with oct.h and mpi code

View: New views
2 Messages — Rating Filter:   Alert me  

problem with compiling code with oct.h and mpi code

by ortak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a code which includes "octave.h", "oct.h" and "mpi.h".

Here's my code :

#include<octave/oct.h>
#include<octave/octave.h>
#include<iostream>
#include <octave/parse.h>
#include "mpi.h"
using namespace std;

int main(int argc, char **argv)
{
 octave_value fff;
 int rank, size;
    MPI_Init( &argc, &argv );
    MPI_Comm_size( MPI_COMM_WORLD, &size );
    MPI_Comm_rank( MPI_COMM_WORLD, &rank );
        octave_value f_ret;
        if(rank==0){
                int a[2];
                a[0] = 1;
                a[1] = 1;
                f_ret = feval("sum", octave_value(a));
        }else if(rank == 1){
                int a[2];
                a[0] = 2;
                a[1] = 2;
                f_ret = feval("sum", octave_value(a));
        }
       
        int ans = f_ret.int_value();
    //printf( "Hello world from process %d of %d\n", rank, size );
    MPI_Finalize();
    return 0;
}


When I try to compile code I take an error which starts with these lines :

/tmp/ccgEpTDE.o: In function `main':
dene.cc:(.text+0x8d): undefined reference to `octave_value::octave_value()'
dene.cc:(.text+0xce): undefined reference to `octave_value::octave_value()'
dene.cc:(.text+0x101): undefined reference to `octave_value::octave_value(bool)'
dene.cc:(.text+0x157): undefined reference to `feval(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, octave_value_list const&, int)'

I guess my errors is about linking but despite of reading some articles about that topic i couldn't solve my problem. Any one have any ideas??

Re: problem with compiling code with oct.h and mpi code

by ortak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

By the way I compiled with mpiCC.

mpiCC dene.cc -o dene -I $OCTAVE_INCLUDE -I $OCTAVE_INCLUDEoctave

"dene.cc" is the file I am compiling, and -I $OCTAVE_INCLUDE is my path to .h files.