Skip to content

Latest commit

 

History

History
98 lines (55 loc) · 2.08 KB

CppCompilerC.md

File metadata and controls

98 lines (55 loc) · 2.08 KB

 

 

 

 

 

 

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; }