C++ code inside .c file
Hi,
I know it's wrong and etc...
But for couple of reasons I'm handling with files with .c extension, which have also c++ content inside of them.
I compile it successfully with g++.
CLION give lots of visual errors every place in the .c files which has a c++ reference (for instance, when using the reference '&' sign).
Is there a place to tell CLION to treat .c files as .cpp files?
Or something similar which has more sense?
Thanks
Please sign in to leave a comment.
Hi Yogev!
Could you please describe how did you add your .c files in CMakeLists.txt and how do you get CMake to compile it using g++. It may affect the way CLion threats those files.
I acctually compile it with an external makefile.
In the CMakeLists.txt I added those files with file(GLOB_RECURSE...
Hi Yogev.
Sorry for the delay. Do you still have the problem?
Hi,
Hmm, do you mean, with the new clion version?
Please try using the following command in CMakeLists.txt:
SET_SOURCE_FILES_PROPERTIES(your_file.c PROPERTIES LANGUAGE CXX)Does that help?
It works! Great! Thanks!