Questions tagged [compiler-flags]

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

Parameters that may be passed to a compiler affecting how compilation is carried out. These can have a variety of effects on the paths searched for external dependencies, optimization level, how source code is interpreted, code checks that are performed and preprocessor directives.

479 questions
7
votes
0 answers

Set C-compiler flags to be used by pip installer

I want to create a virtual environment with some python packages on a cluster where different intel processors are available (eg sandy bridge old and haswell new). The login node, from where the installation has to happen, is haswell. So I: pip…
fabiob
  • 273
  • 4
  • 14
7
votes
2 answers

What do the values of the C++ "feature test macros" mean?

To test for a feature, cppreference mentions these feature test macros: link. If the feature is present in the compiler, the macro is defined. But I don't understand why, if defined, they are defined to something like 201606, which I believe is a…
haelix
  • 4,245
  • 4
  • 34
  • 56
7
votes
2 answers

Can xcodebuild delete the contents of the project's Build Folder?

Back in Xcode 9, there was a build option called "Clean Build Folder..." (⌥⇧⌘K), which deleted all files in the build folder, only leaving the folder behind with no contents. Since then, this behavior was removed, the menu item's title changed to…
Ky -
  • 30,724
  • 51
  • 192
  • 308
7
votes
2 answers

How do I dump gcc warnings into a structured format?

Like many, I build my project with the an abundance of warning flags. Since not all warning flags are detrimental, the compilation becomes noisy. Warnings such as "unused variables", "shadowing members in initialization lists", "missing switch…
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
7
votes
8 answers

Automatically find compiler options for fastest exe on given machine?

Is there a method to automatically find the best compiler options (on a given machine), which result in the fastest possible executable? Naturally, I use g++ -O3, but there are additional flags that may make the code run faster, e.g. -ffast-math…
Frank
  • 64,140
  • 93
  • 237
  • 324
7
votes
5 answers

built grep slower than grep that comes with Linux

I am trying to understand why grep built by me is much slower than the one that comes with the system and trying to find what compiler options are used by grep that comes with the system. OS Version: CentOS release 5.3 (Final) grep on system: …
kumar
  • 71
  • 2
7
votes
2 answers

What is -ll gcc's flag?

I'm trying to compile a program that there is -ll flag but gcc can't find. What is the l after -lreally a library or is this a typo? is hard find information about this on google.Such term is "vague".
Jack
  • 16,276
  • 55
  • 159
  • 284
6
votes
3 answers

Why does clang complain about using variable-length arrays with '-std=c99' flag?

When I compile this experiment code: int main(void) { int foo = 5; char bar[foo]; } with clang and the '-Weverything' or respectively the separate '-Wvla' flag combined with the '-std=c99' flag, I still get the warning: warning: variable…
6
votes
4 answers

C++ adding Debugging code that only runs when Debugging

As the question explains: I would like to add some debugging code that only runs when the program is attached to the debugger. I would imagine that this flag or pre-processor variable would be different for every compiler... In my case I am using…
Wallter
  • 4,275
  • 6
  • 29
  • 33
6
votes
0 answers

Parallelize CMake's `CheckCCompilerFlag`

I use a lot of compiler flags in my default builds - having CMake check all of those when it is being run from scratch takes about 10-15s on my slower laptop, which can be annoying when I'm rebuilding multiple projects from scratch or switching…
Vittorio Romeo
  • 90,666
  • 33
  • 258
  • 416
6
votes
1 answer

Why am I getting "nvcc fatal : redefinition of argument 'optimize'"?

I am trying to compile on MacBook Pro Retina with CUDA Driver Version: 7.0.36 and cuda toolkit 7.0 in a nVidia GT 750 M, the following code with its makefile but it gives me this error: nvcc fatal : redefinition of argument 'optimize'. Despite…
6
votes
6 answers

What flag silences GCC's warning about no newline at file-endings?

I just read this post about why new-line warnings exist, but to be honest my team has people working on several different platforms and with several different editors (everyone uses what bests suites them), so the warning has become ubiquitous, and…
Robert Gould
  • 68,773
  • 61
  • 187
  • 272
6
votes
2 answers

How to add global CXX compiler flag to yocto build

It seems something obvious to me, but I couldn't find any solution. Suppose I want to add or change a compiler flag/option which applies to all yocto recipes. It is possible to add a global flag somewhere, without changing the recipes ?
Waldorf
  • 833
  • 2
  • 13
  • 24
6
votes
2 answers

Visual Studio C++ compiler flag: what is -Zm200?

I use Qt for C++ development, and today I produced a .vcproj file from a .pro file. I noticed under the vcproj project properties, Qt added this flag into the C/C++ -> Command Line -> Additional Options -Zm200 What is -Zm200?
sivabudh
  • 31,807
  • 63
  • 162
  • 228
6
votes
1 answer

What does the flag "-D_POSIX_C_SOURCE=200112L" mean?

Without it I can't use the libraries needed to connect to the internet, but I don't know what it means: -D_POSIX_C_SOURCE=200112L Can anyone explain?
2013Asker
  • 2,008
  • 3
  • 25
  • 36