Cilk++ Compiler Question

Cilk++ Compiler Question

Thanks for your support!

This question is in the context of converting portions of a large C++ project to Cilk++.

I have constructed a library whose object files are either entirely C++, entirely Cilk++, or sometimes a mix by specifying extern "C++" within Cilk code. There is no cilk_main entry point, and all parallel code is run though invoking the cilk::context object.

When I link a pure C++ file to any of the Cilk++ object code I use the Cilk++ compilier, however, the Cilk++ compilier ignores the .cpp extension and assumes that my source code is cilk source and makes every function a cilk function. This leads to lots of errors about calling cilk functions from a non-cilk context unless I go into my .cpp files and explicitly bracket the entire file with extern "C++".

I know my use is probably considered non-standard, but is there something I'm missing? Is there a compiler option I can use to specify to the compiler which files are of which type, or is there a way to get the cilk++ compiler to perform extension checking?

I'm using gcc v4.2.4 with cilk build 8503.


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

When I've mixed C++ and Cilk++ files, I've typically compiled the .cpp files with g++ instead of cilk++. I _am_ surprised that it ignores the .cpp extension, though, and compiles everything as Cilk++. I believe that cilk++ accepts the same set of arguments as g++, though, so you might be able to force it to compile .cpp files as C++ with "-x none".

Leave a Comment

Please sign in to add a comment. Not a member? Join today