Jump to content

  • Log In with Google      Sign In   
  • Create Account

OpenMP omp_get_num_procs


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Misery   Members   -  Reputation: 317

Like
0Likes
Like

Posted 15 August 2011 - 02:51 AM

Hi there,

I have a strange problem. I'm getting on with OpenMP, however I get error messages when I am trying to use omp functions:

#include <iostream>
#include <omp.h>

using namespace std;

int main()
{
	std::cout<<omp_get_num_procs()<<std::endl;

	std::cout << "Finished" <<std::endl;
	return 0;
}


So the code isn't especially complicated but I get an error:

undefined reference to `omp_get_num_procs

I have read OpenMP manual and there's not mentioned that omp requires any additional libs or dlls.
So what is wrong?

I am using GCC here.

Regards,
Misery

Sponsor:

#2 japro   Members   -  Reputation: 887

Like
1Likes
Like

Posted 15 August 2011 - 03:07 AM

Are you sure you are compiling with "-fopenmp"?

#3 Misery   Members   -  Reputation: 317

Like
0Likes
Like

Posted 16 August 2011 - 01:09 PM

Are you sure you are compiling with "-fopenmp"?


Yes. In fact when using GCC on Linux (Debian, Ubuntu) or MinGW with Code::Blocks, one has to link libraries manually.
I mean, add additional libs to linker directories.

That solved the case.

#4 Sneftel   Senior Moderators   -  Reputation: 1781

Like
1Likes
Like

Posted 16 August 2011 - 02:02 PM

So what is wrong?

You need to include the OpenMP library.

I have read OpenMP manual and there's not mentioned that omp requires any additional libs or dlls.

That's because the manual is about the OpenMP standard, not the particular OpenMP implementation you're using.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS