Why does XCode not recognize this header file - xcode

I am trying to learn XCode and I am following an online course. They are telling to use the #import command to point to a header file. I follow the instruction to the letter and I get an error saying"no such file or directory" but the file is listed under classes and the spelling is identical. I wanted to included a screenshot but could not. Please help!

You are getting that error because Xcode cannot find the file you are trying to import.
Correct usage:
#import "RootViewController.h"
or
#import <Foundation/Foundation.h>
You also have to make sure that the file(s) you try to import are in your Project list. If the file you are trying to import is not in this list, then you will always receive this error.

It is possible that the file has been renamed in XCode. When a file's name is changed in the XCode interface, it's actual name is no longer changed in the file system. It used to, but doesn't anymore. In order for the compiler to find the file, you have to use the path to the header in the file system. Make sure the files are in the same folder and use the name displayed by Finder.

Related

Why are files named "types.go" are ignored in goland?

Since a few days, Goland is not recognizing files named "types.go" as go source files. This is just a problem for syntax highlighting, as the project still runs normally, but it's quite annoying, because it affects both files from my project and from the standard library.
Whenever I try to import the ignored file I get the error:
Build constraints exclude all the Go files in '/[REDACTED]/internal/api/types'
But the file just contains some types definitions, without any build constraint directive.
For example here is a file called types.go
And here the same file renamed
I already tried to invalidate caches, reinstall go and Goland but the problem still remains
types.go is recognized as a plain-text file for some reason. You can navigate to Preferences/Settings | Editor | File Types find File type auto-detected by content or Text and exclude types.go from the patterns list.
Feel free to follow IDEA-258255 to make the process clearer.

Issue with build "dlib" to Xcode

I have to try to use dlib for my project.
However, when I try to build it, I receive a message about:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives"
For solving this issue
I tried to add it new project
I deleted every existing path or data
I tried to build it on "Release mode"
I have still receive a message:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives"
Please, solve my curiosity!
You can check the link for dlib integration. Also check the following things for configuration.
1.Header search path for the lib folder. for e.g. $(PROJECT_DIR)/lib where lib folder contains libdlib.a and dlib header files.
2.Check the Preprocessor macros in build setting whether properly
set or not.
3.Create the Objective c++(change .m to .mm extension) wrapper class which can execute both c++ and objective c code.
*Note import dlib header files in wrapper class not in the main.m or app-delegate otherwise it will gives error.
Also check the Reference.

How do I edit a .sublime-settings file if it's inside a package?

I'm trying to set up a Node build system in Sublime Text. I thought I'd use tanepiper's, and I'm following its instructions exactly, but there's a problem: my Node executable isn't found (yes, it's in my system PATH). It says to edit Nodejs.sublime-settings if that happens, but that file is inside Nodejs.sublime-package, which is an archive.
I can't edit the file in-place in the archive. I've tried extracting the archive and then zipping it up again and calling the zip a sublime-package, but that doesn't work either.
So what am I supposed to do here?
You should create Nodejs.sublime-settings in your Packages/User folder. The settings will be merged properly. If you really feel you need to modify the packaged file, use https://github.com/skuroda/PackageResourceViewer, though I'd recommend against it (for settings) as placing a file with the same name in the Packages/User folder will do what you want.

Xcode Archive won't find header file in subproject

So frustrated with XCode right now. I can build and run from code perfectly fine. However, trying to archive is a disaster.
I created a project, then dragged the .xcodeproj into XCode on the project navigator. Shows up fine, cool. Parent project build settings:
Other linker flags: -all_load, -ObjC
Target Dependencies : CocoaLibSpotify (subproject I'm incorporating)
Link Binary with Libraries : libCocoaLibSpotify.a
When I build my project, the following lines work
#import "CocoaLibSpotify.h"
#import <CocoaLibSpotify.h>
However, when I archive, my project fails to find these files. It's worth noting that the subproject files aren't in the same directory as the parent project. However, isn't that the point of the target dependency/link binary with library? Why is it failing to archive? This seems like it should be a lot easier than it's being.
Thanks.
Edit: Errors from compiling
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/AppDelegate.m:12:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/ViewControllers/LoginViewControll er.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/BaseViewController.h:10:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/Managers.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/AppLogicManager.h:11:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/CoreDataObjects.h:13:
/Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/Track.h:13:9: fatal error: 'CocoaLibSpotify.h' file not found
#import <CocoaLibSpotify.h>
^
1 error generated.`
Archive uses a different directory structure when building, which can be a pain. I've found success by adding the following to the User Header Search Paths build setting of your application's target:
"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" (including the quotes).
Also, make sure Always Search User Paths is set to Yes.
In addition, I have $CONFIGURATION_BUILD_DIR/include in my Header Search Paths setting, but I don't think that'll help archiving.

XCode - why do I get a file not found?

I've added the Airship (from UrbanAirship) directory into my xcode project for my iPhone/iPad app. In my "build settings>search paths>header search paths" and "build settings>search paths>library search paths", I'm pointing to those directories recursively. I've also included the libuairship-1.2.1.a file3 into the required frameowrks/libraries.
When I go into my appdelegate.m and appdelegate.h, as soon as I type #import "UA", it autocompletes for me #import "UAirship.h". So i assume this is great ,because i guess it means it knows the file exists!
but when I do a build, it Xcode complains that the file UAirship.h can not be foudn. I tried typing #import "directoryname/UAirship.h", but it still can't find it.
How do i fix this problem?
I am sure it is the path under - header search paths.
I just had it set to ../Airship/** and had the same problem you did.
Now that I changed it to ./Airship/** and it works fine.
I also had to import
#import "UAirship.h"
#import "UAPush.h"
#import "UAInbox.h"
#import "UAInboxUI.h"
in the application delegate.
Hope this helps.
For XCode 5.1 I had to set this to ./Airship (recursive)
This likely means that the file is part of your project, but its path is incorrect (for whatever reason). This will be visible in that if you locate the file in the project browser its name will be red.
Assuming that is the case you can select it and edit the files location properties, or delete it from the project and then add that file back again.
This can happen easily if you import or open projects from other systems.
Regards
This did the trick for me,
Delete Pod folder and Podfile.lock
then "pod install"
then "pod update”
Or sometimes, pod update and then pod install

Resources