Is there a setting Xcode that lets you treat warnings NOT as errors in Xcode? I'm doing a lot of prototyping code where I don't care if I have an unused variable for example. Xcode is treating these warnings as errors and it is seriously slowing down my productivity. Can't figure out how to disable this though.
In the build settings of your target there's an option named Treat Warnings as Errors. If it is on in your project, turn it off (even though this is the default).
If you open your project in Xcode, then right click on your target in the Targets folder. Select "Get Info" form the drop down menu and then scroll down to the section for the compiler warnings (GCC 4.0 Warnings on my box). Here you can disable the checkboxes for the various warnings you have active. Also check the value of "Other Warning Flags". This could include -Wall or -WMost which will enable other warnings. You can remove that and hopefully your warnings will not appear.
Good luck!
In your Xcode project Build Settings, search for the flag 'Treat Warnings as Errors' and set it to NO. As the name suggests, if you set it to YES, warnings in that project are counted as Errors.
If you have multiple sub projects, this flag can be toggled for each individual project.
Here is a screenshot from Xcode 13.2.1
Xcode 13.2.1 Treat Warnings as Errors
I was getting a specific warning being shown as an error in my specific workspace, The above solutions didn't work for me.
Then I dug deeper in "Build settings", as I suspected there was "Apple Clang -Warnings - All Languages" where that specified warning was being marked to be shown as error .
I had to change it to yes(Error) to yes.
Related
The Microsoft SDK for Azure Storage causes a bunch of linker errors a la
ld: warning: instance method 'AZSULLRangeValue' in category from /Users/macHack/Library/Developer/Xcode/DerivedData/PROJECT-gpihzjouhxvifqcslmywktktizer/Build/Intermediates.noindex/AZSClient.build/Debug/AZS_Mac.build/Objects-normal-asan-ubsan/x86_64/AZSCloudAppendBlob.o conflicts with same method from another category
Is there a way to suppress just the conflicts with same method from another category linker warning?
It's easy to find a list of flags for each clang warning to turn it off on a per-file basis, however I was unable to locate a similar list for linker warnings?
Obviously the idea is to disable the warning as specifically and as locally as possible and retain other warnings for the project.
Any hints appreciated!
In my project I had to copy a library into my source to make some minor adjustments.
This library throws a couple of warnings when compiling. I don't like that ;-)
Since I don't want to change the library code any more than absolutely necessary, I do not want to put #Suppress lines into the library code.
Is there a possability to advise the compiler "Please ignore warnings, but only in src/foo/bar"? Maybe a compiler flag?
I am using a Gradle build, if that opens additional options.
foo.bar is a package and packages can not be suppressed.
Your options are:
Remove compiler warnings entirely
Create separate source set and compile task for the problematic code.
Fix the warnings.
CMake's message() directive has an AUTHOR_WARNING mode, however the documentation (v3.11.1) doesn't say anything on what the differences are between an AUTHOR_WARNING and a regular WARNING.
The documentation states these modes and their description as follows:
WARNING = CMake Warning, continue processing
AUTHOR_WARNING = CMake Warning (dev), continue processing
Author warning are meant to warn the author (developer) of a CMakeLists.txt, but not a user of it. With the CMake arguments -Wdev, -Wno-dev, and -Werror=dev you have control over how to these warnings are handled (documentation).
The idea is that users should not be scared or annoyed by warnings they cannot change anyway, because they are not supposed to modify this part (of potentially third-party) code. This includes programmers who include CMake code from others and don't want to warned about issues they cannot fix within their code.
Since CMake 3.5, the dev flags also suppress or enable deprecation warnings, following the spirit of warning only people who can fix the underlying issues.
I just started using the Clion IDE. Maybe this is written somewhere but I haven't seen it in a Google search. If I put a message() call in my CMake script, where in Clion can I see the output? These message calls are the only way that I know how to debug my CMake scripts.
Use message(WARNING ...) instead of message(...). Warnings go to stderr.
Another possible workaround:
disable "cmake auto-reload" if it is enabled
after you changed something in your cmake file, don't trigger "Reload changes"
run/build your project
When clion starts a build, it realizes the cmake files are not up-to-date and reloads them, but like other build output it is displayed inside the Messages tab.
Warning and errors are displayed, but other messages are currently suppressed. However, there is a feature request concerning this issue.
As of CLion 2016.2.2,
Build #CL-162.1967.7, CLion is displaying CMake message(STATUS) output in its Messages tool window (Alt+0) during Build (Ctrl+F9) when a project is first built after changes to CMakeLists.txt. But as noted in the other answers, this output doesn't show in CLion's CMake tool window (as many would prefer).
Update: Above I wrote that CLion "is displaying message(STATUS) output." I now find that this occurs intermittently. #Michael wrote that this happens if you skip cmake reload after modifying your cmake file, but I've found CLion sometimes does not display any CMake output in its Messages tool window even under this condition. So far I haven't discovered the exact circumstances that make CLion show CMake message(STATUS) output, will report back here when/if I do.
Big Update: CLion opens 2016.3 EAP: user-defined literals, CMake output, C11 keywords completion and more. See in particular:CMake output window: a separate I think it fixes this whole problem: CLion 2016.3 EAP adds a new tab that contains CMake command output.
Of course, this is EAP, which comes with JetBrains' caveat:
It is important to distinguish EAP from traditional pre-release
software. Please note that the quality of EAP versions may at times be
way below even usual beta standards.
So use it at your own risk, but you may judge this a risk worth taking if you need the CMake debugging.
My Problem
I getting "_OBJC_CLASS_$..., referenced from:" linker error when compiling some Xcode projects (it happens in both iOS and Mac projects) I have correctly linked frameworks and imports.
Setup
One application target
One test target
All frameworks linked correctly
On compile I get the following linker errors:
"_OBJC_CLASS_$_JGCountdownTimer", referenced from:
objc-class-ref in JGCountdownTimerTestCase.o
for many classes that are used in tests.
What I've Tried
Checked that imports are all present
Removed all non standard frameworks
If I compile a class for both the test target and the app target it fixes the issue. But then I get other warnings from the compiler.
I faced a similar problem. I got the linker error:
_OBJC_CLASS_$_MyClass
The problem was that I had declared an #interface for MyClass but had not declared its corresponding #implementation.
The fix was to simply add
#implementation MyClass
#end
Quick Answer
Copy and paste the following line into your build settings:
GCC_SYMBOLS_PRIVATE_EXTERN = NO
In the target build settings look for "Symbols Hidden by Default". For the Debug configuration you want "No".
I've had this problem on and off for many months and I've just discovered why.
Not sure if this could be the problem, but with the new compiler, any obj-c that aren't explicitly referred to/invoked will not be linked from libraries. This causes problems when you implement categories in libraries for example.
Try adding '-ObjC' to 'additional linker flags' in the build settings panel for your target. shrug
objc_class_$textfieldvalidator referenced from
Compile doesn't include those copied files in its compile list. To fix this error
select the file or folder, then go to the Build Phases panel and open the Compile Sources step, then click the + button and add them all file or folder.
Right click on a project folder, click "Add Files to ...", select the file(s), click the Options button and select the target, then click Add.