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
4
votes
1 answer

Qt Creator/Linux: setting compiler/linker option -ldl for dynamic libraries

I'm all googled out! Appreciation to anyone who can help me ... I have built test.so and wish to call it dynamically using dlopen(), dlsym(), etc defined in dlfcn.h I can compile my calling program (main.cpp) on the command line without error g++…
Tom
  • 93
  • 1
  • 6
4
votes
3 answers

C++ -malign-double compiler flag

I need some help on compiler flags in c++. I'm using a library that is a port to linux from windows, that has to be compiled with the -malign-double flag, "for Win32 compatibility". It's my understanding that this mean I absolutely have to compile…
Martin
  • 73
  • 2
  • 5
4
votes
2 answers

error passing 'const' as 'this' argument

I'm stuck on an error from so long now, the following, I'm learning and I think I don't understand the error. droid.cpp: In function ‘std::ostream& operator<<(std::ostream&, const Droid&)’: droid.cpp:94:30: error: passing ‘const Droid’ as ‘this’…
Gabson
  • 421
  • 1
  • 4
  • 20
4
votes
1 answer

How do I set compiler options in KDevelop?

I recently moved from developing with code::blocks to developing with kdevelop. (I got fed up of codeblocks being unstable and not being able to set keyboard shortcuts.) As I understand it kdevelop uses cmake to control the building of source…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
4
votes
2 answers

Get architecture type (ABI) to C preprocessor for Android NDK

I'm trying to control my C code in an Android NDK project depending on the selected ABI library. As a start, I want the NDK library method to answer, with a string, what ABI that is used. I did a few tries but all fails to deliver the result. In…
4
votes
0 answers

Setting compiler flags per file in projct template file TemplateInfo.plist

I created a project template file - TemplateInfo.plist which is defined with ARC usage. There are a few external files which I included in the template that are not ARC supported. In a regular project I would set manually the compiler flags for…
4
votes
1 answer

Make a specific gcc warning into an error

So I know I can turn warnings into errors using -Werror=... but I want to make the following warning into an error: "Class xxx has virtual functions but non-virtual destructor" The only way I know you can get this error is by turning on the overly…
user869525
  • 769
  • 2
  • 12
  • 21
4
votes
1 answer

Cabal: conditionally override a flag default value

Is there any way to rewrite either: flag llvm description: compile via LLVM default : if os(mingw32) False else True or flag llvm description: compile via LLVM default :…
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
3
votes
1 answer

Enabling flags (Wall, pedantic) for C/C++ compilation within Eclipse

I am using Eclipse to write C/C++ programs. I would like to compile my code using the -Wall and -pedantic flags. How do I enable these flags within Eclipse so they are used by default whenever I compile a C/C++ program?
Josh
  • 1,357
  • 2
  • 23
  • 45
3
votes
1 answer

Difference between "-fno-pie" and "-no-pie"

I don't find any useful information on the differences between "-fno-pie" and "-no-pie". Are they gcc flags or ld flags? Are they both necessary or not? I found a piece of makefile that uses these lines: CC = @gcc -fno-pie -no-pie LD = @gcc -fno-pie…
Francesco
  • 523
  • 4
  • 25
3
votes
1 answer

.clangd: use different compiler flags depending on file extension

I am using the .clangd configuration file to pass compilation flags to clangd. I run clangd on a codebase with C and C++ files. How can I have some flags apply to C++ files but not C files ?
Gabriel Devillers
  • 3,155
  • 2
  • 30
  • 53
3
votes
1 answer

What is the /d2vzeroupper MSVC compiler optimization flag doing?

What is the /d2vzeroupper MSVC compiler optimization flag doing? I was reading through this Compiler Options Quick Reference Guide for Epyc CPUs from AMD:…
JohnAl
  • 1,064
  • 2
  • 10
  • 18
3
votes
1 answer

How to add SIMD-related compiler flags in visual studio 2010

I found this list of flags: http://www.ncsa.illinois.edu/UserInfo/Resources/Software/Intel/Compilers/10.0/main_for/mergedProjects/optaps_for/common/optaps_dsp_targ.htm and I'd like to try and add some of them to my project. I can't seem to find the…
N.M
  • 685
  • 1
  • 9
  • 22
3
votes
0 answers

how to reserve a CPU register in armclang for AARCH64

I am looking to do an experiment where in I can reserve ARM CPU register, say X25 to be not used by the compiler. Looking at the armclang reference document that says, Syntax -ffixed-rN Parameters N specifies the register number, which can be any…
Thomas
  • 489
  • 1
  • 8
  • 13
3
votes
1 answer

Do I even need `-pedantic` if I specify the standard to ANSI C with `-std=c89`?

If I specify the standard to ANSI C with -std=c89, my code won't run until I perform certain changes to make it compliant with the standard. So do I even need -pedantic at this point if I've already set the -std=c89 flag? By the way, the idea was…
finefoot
  • 9,914
  • 7
  • 59
  • 102