Am I supposed to adjust FRAMEWORK_SEARCH_PATHS or HEADER_SEARCH_PATHS when I add custom frameworks to the project?
I have MainProject.xcodeproject that links SomeFramework.framework that's simply dragged from "Products" in SomeFramework.xcodeproject to "Link with Binary Libraries" build phase in main project.
Framework contains all required headers in its Headers directory. However, in my project I can't simply use:
#import <SomeFramework.h> // I'm pretty sure this file exists
to include this header. Build fails "No such file or directory". Compiler flags include -F…/SomeFramework/build/Release and that directory contains framework with Headers directory symlink in it.
(BTW: this is for Mac OS X. I don't care about iPhone.)
Just adding the path to the directory containing the framework to FRAMEWORK_SEARCH_PATHS will work. Unless it's a typo, your problem seems to be
#import <SomeFramework.h>
which should be
#import <SomeFramework/SomeFramework.h>
Related
I develops PHP extension, and have a problem with search include paths.
With development i create a empty project (Create new project -> Other -> Empty), and add header file:
#include "php.h"
And if i CMD+Click on this file, XCode view Symbol not found. In project configuration section Search paths not exists ;(
In project build setting i have only User Defined section.
How i add include paths to XCode, if i created empty project?
Thank.
P.S.
XCode - 5.1.1
As solution:
Add target Command line application, then there will be search paths section.
I have an Xcode project "App" which references another Xcode project "Lib".
The "Lib" project is generated by Cmake. I use "add_definitions(-DMYDEFINE)" to set a define. This define is used in a .h and a .cpp file in my lib project.
The problem is the header (.h) file. If I use it from within the Lib project, my define is set. If I use the file from my App project, the define is not set (header file of lib is in my include path).
This set/not set happens at the same time, although the header file is guarded with "#pragma once".
I need this define in the header file. Is there a way to organize things such that I can set the define only with Cmake in the Lib project?
I am going to port the C project that was for unix into windows. So far, I could make it compile but not build . The problem I am getting is , some of the functions which are declared in the header files are defined in the yacc files.so I am getting the following errors:
error LNK2001: unresolved external symbol function_name
I am adding .y and .l files in the source directory of the project.I think I could not port yacc files into windows version or am I doing something stupid.I search it on web but could not get proper tutorial for it.Could you please let me know
How could I add .y or .l files in the project.
How would I make those file compatible to the windows?
How can I link them with other object files.
EDIT
I tried with changing the the .l files into the .yy.c files using the flex.exe.Following is the command for it
c:\> flex.exe name.l
Supposing that both the flex.exe and name.l are in C;>.And I loaded those all those files .l .y(previously present for parsing in unix system) .yy.c(corrsonding yacc file for windows) in the solution of previously exisiting project. Once I compile,I get the following
Can't read the header file parserheaderfile.h
This is the header file which needs to be generated by the bison in the unix
system. So I think I am not able to make the bison compatible for windows .So please him me how can I solve this problem?
Thanks in advance.
You need to add custom build rules for your .y and .l files. To do this, you need to
create one dummy .c file for the .l file and the .y file
add the .l, .y and both .c files to the project
right click on the .l file and select properties
Configuration->All Configurations
General->Item Type->Custom Build Tool
Apply
Custom Build Tool->General->Command Line->flex -olexer.c lexer.l
Custom Build Tool->General->Outputs->lexer.c
Custom Build Tool->General->Additional Dependencies->parser.y parser.c
Apply
select the .y file in the solution explorer
Configuration->All Configurations
General->Item Type->Custom Build Tool
Apply
Custom Build Tool->General->Command Line->bison -oparser.c parser.y
Custom Build Tool->General->Outputs->parser.c parser.h
Also you need to have flex.exe, bison.exe and m4.exe in the system search path. Another drawback is that VS does not get the dependencies right, so when you change something in the parser or lexer files, you need to manually rebuild the project.
The Xcode project generates Prefix.pch file automatically. When I deleted this file and tried to build, I got build error saying '*_Prefix.pch' file is missing.
Is Prefix.pch file is a must for compiling with Xcode?
How can I build without the Prefix.pch file?
In Xcode, go to your target's build settings (Command-Option-E, build tab) and uncheck Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER). You can also remove the value of the Prefix Header setting if you wish.
Prefix headers are compiled and stored in a cache, and then automatically included in every file during compilation. This can speed up compilation, and lets you include a file without adding an import statement to every file using it. They are not required, and actually slow compilation whenever you change them.
Yes, you can compile and run the project without .pch file. In Xcode, go to your target's build settings (Command-Option-E, build tab) and uncheck Precompile Prefix Header (GCC_PRECOMPILE_PREFIX_HEADER). You can also remove the value of the Prefix Header setting if u want.
I have been trying to build a code that has dependencies with other header files that are not in the project directory. I added the paths to these header files in both HEADER_PATH and USER_PATH. However, I still see error while building. It says that the file is not found. I verified that the file exist in the path added to the header search path in project settings.
How do I make sure that all my header files referenced in the project is included and the paths are being picked by Xcode during compilation?
I tried copying all the files to the project with no luck. This is the first time iam using Xcode, so its kind of frustrating. Iam a linux guy and comfortable with make files. Is there a Make file for xcode which i can modify to include the header file directories.
You might want to check the order of your source files in your target's build phases to ensure that your dependencies are compiled before your source files that reference them.
Select your project in the Project Navigator.
Select your target.
Click on the Build Phases tab.
Click on Compile Sources to expand the section.
Drag the dependencies to the top of the list.
Are you sure you spelled the header file name correctly ? Is the case correct ? Did you use user quotes "" rather than system quotes <> ?
Assuming you've checked all the obvious things such as the above then one other thing to try is to quit Xcode, delete the "build" folder in your project directory, and try again - sometimes the build folder gets in a pickle internally.