LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with -fopenmp (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-fopenmp-4175467094/)

saadhu 06-23-2013 02:02 PM

problem with -fopenmp
 
hi everyone,I've very basic knowledge about programming.

As a part of program, i had to implement parallel processing in one program file, and that needs to be compiled using a make file. when i was compiling with -fopenmp it is showing the following error

undefined reference to GOMP_parallel_start
undefined reference to GOMP_parallel_end
undefined reference to omp_get_num_threads
undefined reference to omp_get_thread_num
undefined reference to GOMP_barrier

in make file target was written as

problemdef.o: problemdef.cpp
$(CXX) -fopenmp $(CXXFLAGS) $<


and the program was as follows

#include <vector>
#include <complex.h>
#include <iostream>
#include <time.h>
#include <math.h>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <omp.h>
#include <fstream>


#ifndef GLOBAL_H
#include "global.h"
#endif
#include "m_minrad.h"
#include "functs.h"

#define PAR // Comment out if not parallel version
using namespace std;

void test_problem(double* parameters)
{
int i;
#ifdef PAR
#pragma omp parallel for private(parameters,i)
#endif

for(i=0;i<3;i++)
{

obj[i]=function(parameters);
}
}

could anyone please find what's wrong with program or part of makefile,it would be of great help to me :confused::banghead:

Dr_P_Ross 07-02-2013 08:53 AM

It looks like the library containing the OpenMP functions is not being found by the compiler. Typically the library is named libgomp.so.<whatever>. You could check where the loader is looking for libraries by, say, ld --verbose | grep SEARCH_DIR


All times are GMT -5. The time now is 11:47 PM.