Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Disable Optimization for One File in Xcode

Tags:

xcode

llvm

clang

My Xcode project depends on another library, that cause errors in my project when I built it with [-O3] option.
The errors are in just one file. So I want to turn off the [-O3] option for that file.
Is it possible?

like image 956
Chogri Avatar asked Dec 08 '14 07:12

Chogri


People also ask

How do I turn off optimization in Xcode?

In Xcode, look under 'Build Settings' for your target, scroll to 'Swift Compiler - Code Generation' and then 'Optimization Level'. Ensure that 'None' is selected.

What is optimization level Xcode?

The 'Optimization Level' tells the compiler to optimize the build to a certain level. Generally, debug builds are set with 'No Optimization' since it allows the developers to debug through the values contained by let/ var. This is very much required during the debugging phase.

How do I disable gcc optimization?

GCC has a range of optimization levels, plus individual options to enable or disable particular optimizations. The overall compiler optimization level is controlled by the command line option -On, where n is the required optimization level, as follows: -O0 . (default).


1 Answers

Open the target, look under Build Phases. Open the Compile Sources step. Locate the file in question, and click the Compiler flags column to the right.
Enter -O0 to turn off optimisation.

like image 79
Aderstedt Avatar answered Oct 19 '22 12:10

Aderstedt