- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I call the header file on my header file test.h to lock and unlock sections of code.
And in the file write.cpp, i need to lock and unlock sections of code too. so, i call the test.h file which call the fake_mutex.h.
but when compiling, i have the error of multiple definition `cilkscreen::create_fake_mutex()' as following :
...: In function `cilkscreen::create_fake_mutex()':
...: multiple definition of `cilkscreen::create_fake_mutex()'
...:/home/amina/projet/cilkplus-install/include/cilktools/fake_mutex.h:79: first defined here
....
How can i have one copy of fake_mutex to avoid the problem of multiple definition ?
Thank you in advance,
I call the header file
And in the file write.cpp, i need to lock and unlock sections of code too. so, i call the test.h file which call the fake_mutex.h.
but when compiling, i have the error of multiple definition `cilkscreen::create_fake_mutex()' as following :
...: In function `cilkscreen::create_fake_mutex()':
...: multiple definition of `cilkscreen::create_fake_mutex()'
...:/home/amina/projet/cilkplus-install/include/cilktools/fake_mutex.h:79: first defined here
....
How can i have one copy of fake_mutex to avoid the problem of multiple definition ?
Thank you in advance,
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that adding the "inline" attribute to the declaration in fake_mutex.h will fix your problem. Here's the modified code:
// Factory function for fake mutex inline fake_mutex *CILKSCREEN_CDECL create_fake_mutex() { return new fake_mutex(); } // Destructor function for fake mutex - The mutex cannot be used after // calling this function inline void CILKSCREEN_CDECL destroy_fake_mutex(fake_mutex *m) { delete m; }
- Barry
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which OS are you working on?
- Barry
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i'm working on ubunto 10.04
amina@amina-laptop:~/projet/cilkplus-install/examples/princeFGTest$ uname -a
Linux amina-laptop 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:35:14 UTC 2011 i686 GNU/Linux
amina@amina-laptop:~/projet/cilkplus-install/examples/princeFGTest$ uname -a
Linux amina-laptop 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:35:14 UTC 2011 i686 GNU/Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe that adding the "inline" attribute to the declaration in fake_mutex.h will fix your problem. Here's the modified code:
// Factory function for fake mutex inline fake_mutex *CILKSCREEN_CDECL create_fake_mutex() { return new fake_mutex(); } // Destructor function for fake mutex - The mutex cannot be used after // calling this function inline void CILKSCREEN_CDECL destroy_fake_mutex(fake_mutex *m) { delete m; }
- Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works fine
Thank you,
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the confirmation. I've updated the sources.
- Barry
- Barry
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page