I am fairly new to xcode and objective C in general, but have done a fair share in Microsoft.Net and visual studio.
I have just check out the latest google api objective c project. I am looking to add this as a static library to my xcode 4 project.
What i have done:
Add the project file to my existing project.
Link up the dependency on my project build phases
Under Build settings, I have enter -ObjC -lxml2 -all_load
I have build it without error. By running Shift + B.
But my issue is that when i try to enter #import "GTLTasks.h" i get an error no such file or directory.
Do i have to add the respective Service by itself? If so where should i add the files to the GTLxcode.project or my own project?
The service i am talking about is located in the following path source/services/
Sorry if i doesn't make sense as I am still exploring around in xcode and objective c.
Just for the record, I have managed to resolved this issue.
Under the Build Settings of the xcode project, Other linker flags
-ObjC -all_load
Followed by Header Search Paths
$(SRCROOT)/YourFolder/
Where your project folder is located this is where you will place your source files from google.
Related
When I starts a new project (Blank App (C++/WinRT)) on Windows10 1909 # VS2019(up to date) its shows up a lot of errors as if the extension wasn't installed. But after trying to compile and run its works - so why do I get the errors and how can I solve this? screenshot
Edit: I have fond a solution for that. its turns out that the project was needed an additional include directory:
under the project properties->C/C++->General->[Additional Include Directory]
I added the winRT folder:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt
screenshot2
and that's it now there's no errors (correction - after creating new project its still have the same errors)
edit2:
Update: I installed the last windows 10 SDK and was still getting the seam errors. Than I installed a package via cmd with the following command:
D:\vcpkg> vcpkg install cppwinrt:x86-windows
after this was done it seem to work now
edit3:
I'm sorry for the annoying newcomer questions...
its looks like I have another problem now with my project
in the packages.config file is says that the package is not declared with the following warning packages.config pic
thanks for any help in advance.
(edit4) I followed this thread:
nuget 'packages' element is not declared warning
and that's it, now all I have to do is to learn how to code :D
The 'standard' include paths for Visual C++ projects are the VC_IncludePath and WindowsSDK_IncludePath. The Windows SDK includes path already has all of the directories:
include\<10.0.build.0>\ucrt
include\<10.0.build.0>\shared
include\<10.0.build.0>\um
include\<10.0.build.0>\winrt
include\<10.0.build.0>\cppwinrt
"Blank App (C++/WinRT)" is not part of the standard VS 2019 template set. The name of the project in the screenshoot is "ConsoleApplication2", which would imply you created a Win32 console C++ project instead of a C++/WinRT project. Even still, you can reach the standard C++/WinRT headers from a Win32 console application since they are part of the standard path.
From the looks of the errors in your first screenshot, it appears you are using a generated C++/WinRT rather than the one in the Windows 10 SDK. With VS 2019, you must add the NuGet package Microsoft.Windows.CppWinRT to your project to get the MSBuild rules needed to build with the C++/WinRT VSIX installed, so that's likely a problem here. See VS Marketplace
I'm using ObjC to build my app's ui, and my app depends on an ansi c library, I have the ansi c library's source code. How can I use Xcode to compile this app (For development, I can install the library into my Mac). But I want to ship my app to users without any external dependency, just like any other apps, user don't need to install the dependencies, so how can I accomplish this?
If you have static library then add the same to your Xcode project and compile application. During linking phase library is linked with Application binary and hence no separate installation required for the library.
In case library is dynamic library then check the installation path. If the library installation directory is outside application bundle then you need to create installer to install library to installation directory. On the other hand if installation directory is relative to #excutable path then you can keep the library inside your application bundle and no installation required. You can use copy file phase to copy library into your application bundle.Refer Apple documentation
I use xcode 4 to build a cocoa application with a private dylib/framework.
In my development Mac, I put the dylib in the /usr/local/lib directory, and drag it into the project.
The app is compiled and runs perfect on my computer.
To distribute this app to the other Mac, I create a copy Files building phase, and say "copy that dylib to Frameworks directory".
The application is built successfully, and I indeed see the dylib is copied to the Frameworks directory in the app bundle.
The problem is when I run this app in another regular Mac, which does not have this dylib installed. I get an error saying:
dyld: Library not loaded: /usr/local/lib/mylib.dylib
The issue comes from the fact that you copy the framework into the app bundle, so it is available at a location like:
<you_app_path>/Contents/Frameworks
but you try to load it from /usr/local/lib where it is not available on you deployment machine. From Apple Framework Programming Guide:
To embed a framework in an application, there are several steps you must take:
You must configure the build phases of your application target to put the framework in the correct location.
You must configure the framework target’s installation directory, which tells the framework where it will live.
You must configure the application target so that it references the framework in its installation directory.
Now, you say that the build phase is ok; I assume also that you sent the application target build setting correctly. What is left is configuring the framework target’s installation directory.
If you did not build the framework yourself, you should be able to fix this by changing the framework install path so that it is defined relative to the loader (your app), to something like: #loader_path/../Frameworks/ (or #executable_path/../Frameworks). You can do that by means of install_name_tool.
If you are compiling on your own the private framework, you can define its install location in Xcode build settings.
I am using this article as a guide to call into a MonoTouch library from within an Objective-C application. We have an existing iPhone application and an existing c# library which we need to bring together. We have considered re-writing the iPhone app (Objective-C) in MonoTouch, but we do not have the time right now. We need a way to use our MonoTouch library from the iPhone/Objective-C app.
My problem is, the Xcode project generated by calling mtouch cannot be compiled. It cannot find the mono header files and the .s files referenced by the project are not found because they are instead named with a .6.s extension. Am I running mtouch incorrectly? If not, how can I tell the Xcode project where the mono header files are located so it can compile? Also, how can I set up the Objective-C code to call my MonoTouch library (the main.m file has some clues, but it does not appear to be straight-forward)?
Here are the type of errors:
error: mono/jit/jit.h: No such file or directory
I have just added a linked library to my project using the question here Process for linking static ObjC libraries in XCode and the document linked to in the answer.
I happen to know the library uses CoreData objects, like NSManagedObject, although in the library's xcode project the CoreData framework isn't added and it builds with no errors. However when I build my app it comes up with several errors such as:
Undefined symbols:
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_AClass in library.a(AClass.o)
So seeing as all the errors mentioned CoreData objects, I added the CoreData framework to my app and it built successfully.
So now I tried remove CoreData framework from my app and added it the libraries project and them built both and it failed.
So why does it work when I have coredata added in my project but not in the libraries project, and only the library uses it?
(and why does the library build without needing the coredata framework on its own?)
The library is static. It is not a stand-alone piece of code, it must be linked.
Your application is linked, which means the linker resolves all the external dependencies and fills in the library functions' addresses in the final executable.
If you want to use a library that has a Core Data dependency in your application, you must link against Core Data.framework.
Adding a linking stage to a static library has no effect, since there is no linker involved in creating a static library, only a compiler (and an archiver).
Now, the problem can sometimes be avoided by using the new #import syntax in your libraries header file. The compiler will then automatically link against the used framework, even if you use a static library.