(C++) How to use Qt Creator to compile C code?
January 9, 2018 · View on GitHub
(C++)
How to use Qt Creator to compile C code?
How to use Qt Creator to compile C code? is a Qt FAQ how to use Qt Creator to compile C code.
Add the following lines to your Qt project file:
QMAKE_CXX = gcc QMAKE_CXXFLAGS = -x c
Full example
Qt project file: CppCompilerC.pro
QT -= core gui #Compile with Gnu C compiler QMAKE_CXX = gcc QMAKE_CXXFLAGS = -x c TARGET = CppCompilerC CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
main.cpp
///C code that is invalid C++ code struct template { int new; struct template* class; }; int main() { struct template t; t.new += 1; t.class = 0; return 0; }