Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » OpenMP and Eclipse(OpenMP)
OpenMP and Eclipse [message #901477] Sun, 12 August 2012 22:37 Go to next message
Andi Maier is currently offline Andi MaierFriend
Messages: 5
Registered: July 2012
Junior Member
HI all,

I have currently some problems with OpenMP and Eclipse Juno.
I have installed the MINGW C Compiler and managed to run a program with PThreads. However, I tried to run a program with OpenMP which does not work.

My programm is the following:

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>

int main(int argc, char **argv)
{
int id;
#pragma omp parallel private(id)
{
id =omp_get_thread_num();

printf("%d: Hello World!\n", id);
}
return 0;
}

and I receive the following output:

Info: Internal Builder is used for build
gcc -O0 -g3 -Wall -c -fmessage-length=0 -fopenmp -o tt.o "..\\tt.c"
gcc -fopenmp -o OpenMP.exe tt.o

tt.o: In function `main':
C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:16: undefined reference to `_GOMP_parallel_start'
C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:16: undefined reference to `_GOMP_parallel_end'
tt.o:C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:18: undefined reference to `_omp_get_thread_num'
collect2.exe: error: ld returns 1 as end-status

I think that it is something to do with the library libgomp since the functions are defined in that library but I cannot figure what.

It would be great if somebody could help me!

Regards,
Andi

[Updated on: Sun, 12 August 2012 22:38]

Report message to a moderator

Re: OpenMP and Eclipse [message #901487 is a reply to message #901477] Mon, 13 August 2012 06:03 Go to previous message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
> and I receive the following output:
>
> Info: Internal Builder is used for build
> gcc -O0 -g3 -Wall -c -fmessage-length=0 -fopenmp -o tt.o "..\\tt.c" gcc
> -fopenmp -o OpenMP.exe tt.o
> tt.o: In function `main':
> C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:16: undefined reference
> to `_GOMP_parallel_start'
> C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:16: undefined reference
> to `_GOMP_parallel_end'
> tt.o:C:\Users\Andi\workspace C\OpenMP\Debug/../tt.c:18: undefined
> reference to `_omp_get_thread_num'
> collect2.exe: error: ld returns 1 as end-status
>
> I think that it is something to do with the library libgomp since the
> functions are defined in that library but I cannot figure what.
The linker cannot find the library. Add libgomp to you linker libraries.



--
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl


Cheers,

Joost
Previous Topic:Problem installing on Linux
Next Topic:error in #include statement
Goto Forum:
  


Current Time: Fri Mar 29 12:12:52 GMT 2024

Powered by FUDForum. Page generated in 0.03395 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top