1
votes

I have qmake project with some headers and some .c files, in some of the header files I'm using C++11 headers, I have added CONFIG += c++11 option in .pro file, but the problem is IDE is not able to include C++ 11 specific headers say vector (for syntax highlighting), but the code builds. The issue resolves at the moment if I add a C++ class with .cpp file. But I dont want to do that.

Qt Creator version 4.5.1

Qt 5.6

Does anybody have a solution for this issue?

1
You have C++ code in .c files? - Mat
@Mat Yes, I have few .h files and few .c files - Nikhil Augustine
Well that's going to confuse a lot of tools. Use .cpp, .cxx or .cc extensions for C++ code. - Mat

1 Answers

1
votes

If you are using GCC as your compiler, it only recognises files with the following extensions as C++ source files: .C (note the uppercase), .cc, .cpp, .CPP, .c++, .cp, .cxx. I'm not aware of a compiler that recognises .c as a C++ source file.

Rename your source files' extensions to one of the above so that QtCreator is not confused.