- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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 Solução
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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 copiado
5 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Which OS are you working on?
- Barry
- Barry
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
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
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
It works fine
Thank you,
Thank you,
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks for the confirmation. I've updated the sources.
- Barry
- Barry

Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora