Where in Qt Creator Do I Pass Arguments to a Compiler

Where in Qt Creator do I pass arguments to a compiler?

Depending on your build system it's either in your qmake project file(.pro, standard for new projects) or in one of the CMake files (CMakeLists.txt, used by KDE and several other projects).

Using .pro:

QMAKE_CXXFLAGS += -O2

Using CMake:

set( CMAKE_CXX_FLAGS "-g -Wall")

QtCreator and Command Line Arguments

Go in the "Project" part on the left of QtCreator and then in the "Run Settings" tab. There is a Arguments line edit where you can put all you need to pass to your app when launching it.

For Qt Creator from Qt 5.6
Go in the "Projects part on the left and then in the "Build & Run" tab. Here you have a "Command line arguments" edit where you can put all parameters you want to pass to your app.

Configuring the GCC compiler switches in Qt, QtCreator, and QMake

It boils down to reading the manual. Instead of using CXXFLAGS in the .pro file, you need to use QMAKE_CXXFLAGS as in:

main.cpp:

#include <cinttypes>

int main() { return 0; }

main.pro:

SOURCES += main.cpp
QMAKE_CXXFLAGS += -std=c++0x

make arguments with qt creator

Found it! In Projects (the wrench icon) / Build Settings / Build Steps / Details there are make arguments. One can also add custom build steps that are not in the makefile!

How to enable custom gcc parameters in Qt Creator?

You need to add QMAKE_CXXFLAGS += -std=c++0x to your .pro file.

Passing arguments from qmake to moc per header

The -f argument adds an include to the generated output. You can achieve the same by leveraging the Q_MOC_RUN macro. It's even documented - together with command line options, no less :)

// foo.h
#ifdef Q_MOC_RUN
#include "foo_extra.h"
#endif
...

// bar.h
#ifdef Q_MOC_RUN
#include "bar_extra.h"
#endif
...

How to add options to gcc in qt creator?

Add LIBS += -lGL -lglut to your .pro file.

QMAKE_CXXFLAGS is for C++ compiler flags like -std=C++0x

Linux QT GCC OpenGL GLEW - add parameters to compiler

Wrong variable. You want

LIBS += -lGL -lGLEW -lglfw


Related Topics



Leave a reply



Submit