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
How to Call Derived Class Method from Base Class Pointer
How to Get the Executable Name of a Window
C++ Comparison of Two Double Values Not Working Properly
What Is the Use of 0-Length Array (Or Std::Array)
Base Pointer to Array of Derived Objects
How to Use Dynamic Name for Variables in C++
What Happens When You Bit Shift Beyond the End of a Variable
What Is Linux's Native Gui API
How to Call on a Function Found on Another File
Waiting Thread Until a Condition Has Been Occurred
The C 'Clock()' Function Just Returns a Zero
Convert a Unicode String in C++ to Upper Case
How to Read Bmp Pixel Values into an Array
How to Overwrite Only Part of a File in C++
Overload Operators as Member Function or Non-Member (Friend) Function
2D Diamond (Isometric) Map Editor - Textures Extended Infinitely