code::blocks compiler flags are being set even though they appear to not be selected - codeblocks

During a former build of my project I enabled the -std=c99 and -D_GNU_SOURCE flags in "other options" for the compiler in "build settings" in code::blocks. The next time I opened the project, those flags were not longer listed in the "other settings" box, but when I rebuilt the project they were still being used as flags for the compilation.
I no longer want those flags active, but I can't delete them or remove them because they don't appear in the "other options" box any more.
Any idea how to get rid of them?
EDIT: I was able to get rid of them by just deleting the project and redefining it from scratch. Is there a less nuclear option?

Related

Per file compiler flags in Xcode 8.1

I need to add some specific compiler flags only for certain files in my project. I did some googling and found out that this used to be possible in the file inspector in older Xcode versions. I'm on Xcode 8.1, however, and I can't seem to find where I can add custom compiler flags for certain files.
Could anybody please tell me how this is possible with Xcode 8.1?
Go to the navigation bar of your project
Click on your project
Click on the target you want to modify
Click on Build Phases
Look for the file you want to add the compiler flag in the Compile Sources list; in this list you should see two columns: name and compiler flags
Click on the latter column and a popup window should come up; add the compiler flags to that specific file

Force CodeBlocks To Build Unchanged (Up-to-date) codes

I would like to know how to make codeblock, when I press build button, always compile the hole code, even if the code has not changed. Right now, when I try to build, it shows the following message:
Target is up to date.
Nothing to be done (all items are up-to-date).
I would like to force it to build again, even if the resulting .exe is the same.
On Codeblocks 12.11, there is a a "Rebuild" (Ctrl-F11) option under the Build menu or when right-clicking on a project. This forces recompilation and averts the "up to date" message.

XCode 4 - Release Mode Flags, Build Flags, Link Flags

I'm working with XCode 4.6 on MAC OS X 10.8.
I'm new to this IDE and platform.
I have a project I compile and optimizations are turned off by XCode.
It doesn't matter if I set Release Scheme.
I saw at the thread named "Cannot Disable Debugger with XCode 4.5" that it has to do with the flags '-O0' and '-Os'.
I know that some flag set "Debugging Mode" which means no optimization is done and more data is generated by the code to help debugging.
I just can't find the single parameter which controls this behavior in XCode (Like /Mtd in VS).
Which parameter in the XCode options controls this parameter?
Moreover, In VS it is easy to see the build parameters as a command line (Under options, both Linker, and Build).
Where can I see that in XCode?
Thanks.
All the compiler and linker flags can be found within a project's or a target's "Build Settings" (targets can overwrite their projects' settings). To get there, select the project file, then select your current target, and go to "Build Settings". Select "All" and "Levels" at the top to display all available options and where they are set (project or target -- left-most wins).
The options are grouped, e.g., linker options and compiler options, and most of them refer to flags. Xcode shows a descriptive name rather than the full flag name. To see the latter, select the line of interest and select the "Quick Help Inspector" in the right panel ("Utilities" panel). The flag you seem to look for is called "Optimization Level" in Xcode.
You can set each option's value, and Xcode may display some meta information next to the raw value, e.g., "Fastest, Smallest" for -Os, or "None" for -O0. You can set all options for each configuration (by default, Release and Debug) independently. Which configuration is actually used depends on your build action. If you build & run, Debug is used by default. If you archive an application, Release is used by default. However, you can change most of that by editing the schemes.
Update:
To get an idea of the differences between the Release and Debug configuration, look at the "Build Settings" of a given target. If an option's value differs in both configurations (or any other configuration you may have), there's an arrow in front of the option's name which indicates the differing values. E.g., take the "Build Active Architecures Only" setting. In debug mode, it assumes you build for a particular testing device so there's no need to include code generated for other platforms as well. However, if you build your app for distribution, you want to build one app that includes code for all target devices/hardware architectures.
Other options to look into:
-Debug Information Format: The way debug information (crash reports) are stored. In Release mode, this is set to "DWARF with dSym", which means that your crash reports are encrypted so no one else can get meaningful information (symbol names) out of them.
-Strip Debug Symbols During Copy
-Optimization Level, as mentioned above
-Preprocessor Macros: This allows you to make your code (statically) dependent on the build configuration, e.g., to log only in Debug mode
Xcode provides more (and probably more accurate) information on all these options in the above-mentioned "Quick Help Inspector", just select any option.
From my experience, despite the optimisation, Release builds are often faster (i.e., they build faster) and definitely smaller in size.

(XCode) Turning off warnings when compiling certain files?

I use several third-party libraries in my iOS project that generate some warnings. Is there a way I can turn off warnings on those specific files only, similar to the way you can turn off ARC on a per-file basis by adding the "-fno-objc-arc" flag to the "compile sources" area in build phases?
In Xcode, there's an option to set per-file compiler flags:
In the Project Navigator pane, click on your project
Select the target you're building with
Choose the Build Phases tab
Scroll down and expand the Compile Sources phase
Locate the "Compiler Flags" column
Set the compiler flag to -w for the file you want to suppress warnings for

Can you batch change per-file compiler flags in Xcode 4?

I'd like to be able to change compiler flags for a whole set of files.
When accessing per-file compiler flags from the "Build Phases" area you can change flags one at a time, however say I'd like to change the flags for every file in a group (e.g., the DropBox or Facebook SDK).
Anyone know how to do this in Xcode 4.0.x?
Fortunately, YES :-)
In Targets->Build Phaes->Compile Sources, mark all the files you like to set a compiler flag for, press RETURN (hit the enter key!), put the flag in the upcoming window and you're done!

Resources