Łukasz Przeniosło
Łukasz Przeniosło

Reputation: 2949

Qt creator pure C project

I am trying to use the Qt Creator for Ansi C program development. My problem is that I am still getting typical for g++ warnings, such as variable length array used. Is there a way to force the Qt Creator to use gcc only and never g++ at any stage (compile, link etc)?

Upvotes: 0

Views: 1895

Answers (1)

Former contributor
Former contributor

Reputation: 2576

I've needed to think about this twice in the past, when building Qt/C++ projects that were using a subproject that I wanted to compile as a C static library in QtCreator: FluidSynth and Sonivox.

QtCreator has a wizard to create a plain C application (Welcome -> New Project -> Non-Qt Project -> Plain C Application:

QtCreator Plain C Application Wizard

The compiler is not a problem; qmake does the right thing based on the suffix of the source files: gcc for *.c, and g++ for *.cpp . You only need to worry about linking, and about LFLAGS and CFLAGS when they need particular values:

QMAKE_LINK = $$QMAKE_LINK_C
QMAKE_LFLAGS_RPATH = ...
QMAKE_CFLAGS_DEBUG = ...
QMAKE_CFLAGS_RELEASE = ...

Upvotes: 1

Related Questions