I am experiencing the following error while compiling my code with iOS5.With previous version it seems fine
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/usr/include/sqlite3.h:230:24: error: redefinition of 'sqlite3' as different kind of symbol [3]
any suggestions
I have the same problem. I discovered that when I change the "Compiler for C/C++/Objective-C" from "Apple LLVM compiler 3.0" back to "LLVM GCC 4.2" the error disappears. (but that's not the preferred iOS 5 setting)
Also it seems that sqlite3 is now included by default in iOS 5.0, which might cause the redefinition error when you included the sqlite3 as a framework in your project. But even when I removed the framework from my project, the error kept appearing (but only 2 instead of 4 this time).
I just had the same problem. My issue was that I had used a forward declaration in my header file. This conflicted with a line of code in sqlite3.h:
typedef struct sqlite3 sqlite3;
Rather than using forward declaration, simply use #import <sqlite3> in the header file to avoid this issue.
(I realize that this may not have been the problem in your case, Qamar, but I'm posting it for those future coders who encounter this bug)
Related
I just noticed weird behaviour of Xcode11, I am executing same code in Xcode 10 and Xcode 11.
See the below attached screenshot for both the versions.
I am creating a url from String, When I put a debugger and check the value of myUrl it shows nil although at very next line it passes nil check and control goes into the not nil case.
See the console too.
have anyone already faced this type of issue? or I am doing something wrong.
P.S: Already Cleared cache, derived data, clean build, restart Xcode. don't confuse with the breakpoint's location, both are captured with different system.
Thanks in advance.
This is a known bug, affecting LLDB (the Xcode debugger) as well as the REPL. It's purely a matter of display:
https://github.com/apple/llvm-project/issues/4477
https://github.com/apple/llvm-project/issues/4479
And see:
Instantiated optional variable shows as nil in Xcode debugger
An easy workaround for now is to pass thru the bridged Objective C type. The bug is only with the Swift Foundation overlay type. So in this case just cast to NSURL.
So for example:
But:
This bug is slated to be fixed in Xcode 12.5.
I am using an answer since for the comment would be too long, but
would be more appropriate.
I am currently (catalina, xcode 11.1) facing many similar issues, beside a general slow down of the debugger.
To be sure anyway:
check that in the target build settings the compile time optimization is disabled for debug: Optimization Level -O0 (the var may be optimized away)
this solved some of my issues as well (disabling the diagnostic made lldb a bit faster and solved issues with p/po and collecting the stacktrace): Xcode 11 extremely slow - A known problem?
I need to do some non-trivial refactoring in a mixed objc & swift project.
But after some code editing, the new Xcode10 compiler crashes every time.
I'm sure there are some errors in my refactored code, but the compiler is not able to show where. It just says :
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
So frustrating! Impossible to debug!
Of course, I updated the whole project to Swift 4.2, so I cannot roll back to Xcode 9.4 :(
Is this a bug? Is there some compilation parameters to make swiftc giving better errors?
Thanks
EDIT: just tried with Xcode 10.1 (beta), and the same problem persists.
EDIT2: after investigations, it seems the problem occurs when I import the objc generated interface header file (the one generally finishing with *-Swift.h). Still no solution.
I'm using Xcode 4.5 and LLVM 4.1 to compile some code I'm working on.
The error I am getting repeatedly is:
"error: use of undeclared identifier 'assert';
The right includes are in the header (#include cassert (I have also tried #include assert.h) but no luck.
Someone else has taken my exact code and compiled it on another computer running the same setup (Mac OSX 10.8, Xcode 4.5, LLVM 4.1).
I had exactly the same errors as yours. For my case, it turns out that there was another assert.h on the include path (CMake introduced erroneous include path for gmplib. I spotted the wrong include path when make VERBOSE=1). Not sure whether it is the same case here. LLVM itself should not have any problem with such an old header file.
Are these errors happening in boost code? If so, you can turn off assertions (and get rid of your error) by including the following preprocessor definition in your build settings.
BOOST_DISABLE_ASSERTS
Ran into this today, I had Always Search User Paths turned on.
I've got an incredibly annoying issue that is hampering my workflow. In my project I have "User of undeclared identifier" errors all over. They are all in reference to a single class, specifically a Theme class. I checked for any circular referencing with my imports, none. I'm really confused.
Here is a screenshot of the errors. I would post errors in the Build Log for more detail, but there aren't any. It builds and runs just fine...
I've tried cleaning, deleting the derived data... Any ideas?
I was having the same problem and noticed that all of the undeclared identifiers were declared in files that were in my pch file.
With this in mind I deleted one of the #import lines from the pch file and recompiled which failed as expected. I then put the deleted line back in, recompiled and it compiled normally with all the false errors gone.
Hopefully this simple solution helps a few of you out if the above solutions don't.
These kinds of errors are quite common with Xcode, unfortunately. It would be great if it would auto-refresh its error list all the time, but it doesn't always. When this happens, I strongly suggest that you restart Xcode, which will flush its error cache and hopefully solve your issues.
How are you including this class? In most cases I just include the class explicitly in header and/or body - instead of the *.pch file. Then this error goes away in my case.
Also deleting the derived data workes once in a while. Did you change the location in preferences recently by any chance. I also got this error when I use a ramdisk for derived data and then go back to default. This is the most annoying case - since it causes this error to appear then in almost every file.
This error seems to happen more often in Xcode 4.4 than the prior versions.
Have you included the library files correctly? Take a look at that. Sometimes ARC issues might occur if we don't include the correct file, or something's missing or not connecting UI.
For me the issue was that I created UnityInterface.h/m file to handle the obj-c to c# interface. UnityInterface.h is already defined by Unity. I renamed my own UnityInterface to _UnityInterface and now everything works.
Just posting this for anyone who might have this problem later and doesn't find any of these solutions to work:
If you have any pragma marked #if statements that only execute if the program is in debug mode it will obviously cause anything declared inside of them to not be declared when you try to archive/export.
I had the same problem. Closing and opening XCode didn't help.
I solved it by checking errors in other targets and fixing them (I had tons of errors in my unit testing target). Also I moved header links from h files to m files. But I'm pretty sure, that the first thing was critical.
For others who experienced the same problem and tried all solution above with no result, perhaps you should try something like I did. I solved the problem simply by unplugging my iPhone USB cable from my Mac and then replugged again those cable. After that, rebuilt again and all undeclared identifier errors were gone.
I had the same error. In my case, it was on this line of code:
- (void)playerItemDidReachEnd:(NSNotification *)notification {
// some code
}
My error message said:
Use of undeclared identifier 'playerItemDidReachEnd'
I tried added this line to the .h file:
- (void)playerItemDidReachEnd:(NSNotification *)notification;
I cleaned it, I re-booted my macbook, and I was still getting the error.
Finally, I decided to try to delete the line in the .h file. I then pasted it into a text file, and then copied and pasted it back in to the .h file.
Now I cleaned and VOILA' !!! no more errors. Go figure. This happens sometimes in VBA. Somehow there seems to be unseen formatting in a line of code. So I thought it might be happening with xCode. Cutting it out, pasting into a text file, cutting out of the text file, and pasting it back in right where it was - fixed it in my case.
---- UPDATE -----
The above was posted as my answer. Apologies, apparently there's something else wrong.
After cleaning - my ERRORS were gone. Now I tried to build and run my app. THE ERRORS CAME BACK! So this time I re-created the class files after cutting out all the text, and pasting it into a text file. I did it for both my .m and .h files. But now the errors are back again after trying to run. SORRY. I don't know how to delete this text altogether cuz it is not an answer.
Tried to build and run my app. THE ERRORS CAME BACK!
There was also an error msg that I was missing a bracket ( } ). Finally I looking at the method just before this method, and sure enought it was missing the ending bracket! That was it!
Might be little late in answering.
I had this issue very recently. I fix this by updating my OS and then updating Xcode. I tried updating Xcode alone but did not happen because Xcode 9.4 requires OS High Sierra 10.13.*
Happy Updating :)
It it compile time error
Use of undeclared identifier '<class_name>'
I was run into this issue when developing own framework and app. Objective-C consumer -> Objective-C static framework
Report Navigator had a clear description
umbrella header for module '<module_name>' does not include header '<class_name>.h'
The solution was just to add #import <class_name>.h into umbrella header in a framework target
Try to click Product -> Analyze, after that to Product -> Build. This helped for me.
i get many warnings of type:
'__strong' only applies to objective-c object or block pointer types; type here is...
the warnings are pointing to framework headers. e.g NSNotification, NSURL, NSIndexset etc..
what are they and how can i repair it?
note 1: i use ARC
note 2: the app seems to work
edit 1: the warnings seems to originate from my pch file. which is:
//
// Prefix header for all source files of the 'myapp' target in the 'myapp' project
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
edit 2:
example of warning:
warning in NSString.h point to:
/* Methods to convert NSString to a NULL-terminated cString using the specified encoding. Note, these are the "new" cString methods, and are not deprecated like the older cString methods which do not take encoding arguments.
*/
- (__strong const char *)cStringUsingEncoding:(NSStringEncoding)encoding; //"Autoreleased"; NULL return if encoding conversion not possible; for performance reasons, lifetime of this should not be considered longer than the lifetime of the receiving string (if the receiver string is freed, this might go invalid then, before the end of the autorelease scope)
Amir's answer did not work for me, but it led me to a similar solution: make sure you also don't have a Frameworks path in your FRAMEWORK_SEARCH_PATHS in project settings or target settings. Mine had an entry that looked like this:
$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
The symptom was that if I command-clicked Foundation/Foundation.h in my prefix.ch and then right clicked in the page->Show in Finder, it was in iPhoneOS.platform. But doing the same with Availability.h took me to iPhoneSimulator.platform.
So having some files including from each platform seems to have caused the __strong warnings and also some link errors where it said missing architecture i386, so I lost the ability to run inside iOS Simulator.
This bug took me 2 days to solve because that path had been in my target settings for months, but wasn't causing problems. Something about going to Xcode 6 revealed it, but not immediately, it just occurred spontaneously early this week when I was upgrading Google AdMob SDK and perhaps triggered a cache rebuild.
The particularly insidious thing about it was that trying to compile backups of my project also failed with the same error.
Let that sink in for a moment, and imagine the sense of impending doom.
I began to suspect hardware failures or a virus at that point, but luckily..
The bug was at the Xcode level, not the project level. Which leads me to believe it has something to do with SHARED_PRECOMPS_DIR, CACHE_ROOT or possibly /var/folders but by then I had upgraded to Yosemite out of sheer desperation and could not diff my hard drive against my Time Machine backup, which had Mavericks. In hindsight, that's where I blew it. That meant that I had to try a dozen other potential solutions involving PCH and other caches, none of which worked. Neither did deleting the project's derived data directories in:
~/Library/Developer/Xcode/DerivedData
(Which I had done based on this answer)
See also:
Can't Build in Xcode 6 - ARC Issues in Apple Frameworks
and:
Build Error - missing required architecture i386 in file
Specifically:
Sean Roehnelt's answer
it seems i've solved it.
for some reason i had a "Framework" folder with headers in my project local folder. removing that folder and the warnings are gone. i don't know how and why that folder was created. (i did not created it).
This is a wild guess : is your project using gcc ? If it is, try switching to clang