Linking C++ and Cilk++ files.

Linking C++ and Cilk++ files.

I was trying to use a classfromsepeate C++ code in my Cilk++ code, and encountered compilation errors. Adding the following code at the beginning of Cilk++ code to include both header and C++ code fixed the problem. Thanks. -Hailong

CILK_BEGIN_CPLUSPLUS_HEADERS
#include
#include
CILK_END_CPLUSPLUS_HEADERS

3 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Good tip. As a general rule, if the Cilk++ code can be isolated effectively, apart from alleviating some of the integration difficulties, you may see performance improvements.

That aside, I'd be interested to know what the compilation errors were. Were they linker errors?

Thanks for the advice. If I don't include the cpp file in Cilk++ code and try to link the object files as below:

$ g++ -c mycode.cpp
$ cilk++ -c newcode.cilk
$ cilk++ mycode.o newcode.o -o newcode.exe -O2

I would not pass the second command line. Say I have a class called myclass implemented in mycode.cpp then I would encouter errors like "myclasshas not beedeclared" or "myclass was notdeclared in this scope".

When I included both the cpp and header file in the Cilk++ code, I was able to compile the Cilk++ code in one step with no errors:

cilk++ newcode.cilk -o newcode.exe -O2

-Hailong

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!