0

I am porting my windows code to linux. when i am using ACE_Atomic_Op api, compiler is throwing some error as shown below

variable "ACE_Atomic_Op<ACE_Thread_Mutex, unsigned int> AcsHcs::Cache::cnt" 
has initializer but incomplete type"

my code is as follows:

in Cache.h file i have

static ACE_Atomic_Op<ACE_Thread_Mutex, unsigned int> cnt;

and in cache.cpp i am declaring cnt as

ACE_Atomic_Op<ACE_Thread_Mutex, unsigned int> Cache::cnt = 0;

this works fine in windows, but it is throwing error in linux

can anyone tell me whats the problem is?

thanks in advance

Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
user2413497
  • 211
  • 2
  • 3
  • 7

1 Answers1

0

You are lacking an include, please add ace/Atomic_Op.h to your source file. Because of platform differences it sometimes happens that on a platform your get an include for free, when porting to another platform you have to add an explicit include.

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16