apple mach o linker error creating basic AI CC Plugin - c++

there are quite a no. of question on this point. But none of them can guide a solution to my issue. I am trying to create a plugin for Adobe Illustrator CC in XCode Version 6.3.2 (6D2105). Following their official guidelines to create a basic "HelloWorld" plugin giving this linker error.
Error:
Ld /Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug/HelloWorld.bundle/Contents/MacOS/HelloWorld normal x86_64
cd "/Users/Barun/Adobe Illustrator CC 2015 SDK/samplecode/HelloWorld"
export MACOSX_DEPLOYMENT_TARGET=10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug -F/Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug -filelist /Users/Barun/Library/Developer/Xcode/DerivedData/HelloWorld-fzhjlvdzxxobzagznysauclanlgg/Build/Intermediates/HelloWorld.build/Debug/HelloWorld.build/Objects-normal/x86_64/HelloWorld.LinkFileList -mmacosx-version-min=10.9 -dead_strip -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/Barun/Library/Developer/Xcode/DerivedData/HelloWorld-fzhjlvdzxxobzagznysauclanlgg/Build/Intermediates/HelloWorld.build/Debug/HelloWorld.build/Objects-normal/x86_64/HelloWorld_dependency_info.dat -o /Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug/HelloWorld.bundle/Contents/MacOS/HelloWorld
Undefined symbols for architecture x86_64:
"_CFStringCreateWithCharacters", referenced from:
ai::UnicodeString::as_CFString(__CFAllocator const*) const in IAIUnicodeString.o
"_CFStringGetCharactersPtr", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
"_CFStringGetLength", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
"_CFStringGetCharacters", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Looks like the linking error coming from IAIUnicodeString.cpp file, which is a support file provided by the sdk. So I am not having idea to what need to be change there.
I was successful to build FreeGrid and DrawArt project provided with the SDK as sample. I have also checked all the build settings with FreeGrid to my HelloWorld project, no mismatch from that side too.
The project set up can be found in Github.

From Adobe Forum https://forums.adobe.com/message/7723859#7723859:
Add to project settings:
BuildPhases>Link Binary With Libraries: CoreFoundation.framework

Related

xcode c++ project with lua lib got link error

First, I create a c++ console project.
Then, I download the lua5.2.0 from lua.org, then make the lib use [make macosx test] and got the liblua.a.
Finally, I import the lua src into project and drag the liblua.a in project, write some demo code and compile,but get the link error, I confirm there has no grammar error.
Ld /Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Products/Debug/LuaAdapter normal x86_64
cd /Users/luocaixin/Desktop/xcodeWS1/LuaAdapter
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Products/Debug -L/Users/luocaixin/Desktop/xcodeWS1/LuaAdapter/Lua.5.2.0/src -F/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Products/Debug -filelist /Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/LuaAdapter.LinkFileList -mmacosx-version-min=10.10 -stdlib=libc++ -llua -Xlinker -dependency_info -Xlinker /Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/LuaAdapter_dependency_info.dat -o /Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Products/Debug/LuaAdapter
duplicate symbol _main in:
/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/lua.o
/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/luac.o
duplicate symbol _main in:
/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/lua.o
/Users/luocaixin/Library/Developer/Xcode/DerivedData/LuaAdapter-dwqvzxkkhfmcsneiftgqstjfemts/Build/Intermediates/LuaAdapter.build/Debug/LuaAdapter.build/Objects-normal/x86_64/main.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I want to know what cause this error and how to import lua in xcode c++
project correctly.
Did you read the error? It's telling you what's wrong: you have more than one main function. You've included two object files that contain a main function (lua, luac) and probably have one in your test app, too. You need to leave those files out of your project. They are the reference command line interpreter and compiler, respectively. You don't include them if you're embedding Lua as a library.

ld: symbol(s) not found for architecture

First of all I want to say I realise this has been asked a dozen times, and I've read countless solutions without any luck so therefore I'm asking again.
I'm using OS X Mavericks 10.9.5, writing in Sublime 3 and compiling using terminal with g++
I'm trying to compile this simple file (test.cpp)
#include <iostream>
#include <SDL2/SDL.h>
int main () {
if(SDL_Init(SDL_INIT_VIDEO)) {
std::cout << "I made it this far" << std::endl;
}
return 0;
}
Compiler line :
g++ test.cpp
This returns the error :
Undefined symbols for architecture x86_64:
"_SDL_Init", referenced from:
_main in test-ebbae4.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So, I've tried adding a lot of different flags, -m32 only changes the result to throw Undefined symbols for architecture i386: and ld: symbol(s) not found for architecture i386
I've tried different -arch variations, but I can't seem to get it to work. also played around with -l -I flags but I'm not sure I know what they do/how they could help..
Does anyone have a clue what to do next?
EDIT : Some additional information. I've tried using the .framework for SDL2, that didn't change anything, currently I'm using SDL2 installed through compilation of the source. Headers located in usr/local/SDL2
g++ test.cpp
You should specify the SDL library, too:
g++ test.cpp -lsdl2
You might need to include a path if its not well known to the compiler driver:
g++ test.cpp -L/path/to/the/library -lsdl2

Whenever I try to link a library I get an error

I'm trying to learn FLTK for C++ and I'm working on a Macbook with the clang++ compiler. Whenever I try to link the library like this:
clang++ -L/usr/local/lib -lfltk
It gives me this error:
clang: warning: argument unused during compilation: '-X11'
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've looked on a couple other forums to see how to fix this problem and haven't gotten any answers that worked. I also tried reinstalling Command Line Tools from Apple's Developer site.
You have to make sure you put the linker command (-L/usr/local/lib -lfltk) before doing filename.cpp -o Exectuable but still in the same line in the command line.

C++ Compilation Issue - Undefined symbols for architecture x86_64 - Mac Os X Mountain Lion

I'm having a compilation issue which I'm unable to solve. I'm developing a cross platform C++ project coding on both Mac Os X 10.8 and Windows. The code compiles and run fine on Windows and on Mac Os X Leopard as well.
Since Apple pushes the developers to stick to the latest platform for various reasons I'm forced to develop on Mountain Lion and I'm trying to get the project to work again.
I compiled correctly all the libraries I needed (wxWidgets, etc) and I imported the project in the latest version of Eclipse. When I try to build the project it tries to compile the firts .cpp file and at the end it (why?) tries to invoke the linker resulting on a series of missing symbols for my own defined classes. None of the other .cpp files is being compiled, so it's pretty understendable why the whole process is failing.
I also tried to invoke make from CLI, with the same result. I went into the makefile and everything seems correct. It looks like a very newbie issue, I feel I'm missing something huge here.
I'm pasting below the output of the compiler, just in case some compiling guru step in. Please feel free to ask for more details.
Compiler output
Pastebin Link: Compiler output
I used PB since the output is quite large.
The relevant section are the invocation of as and collect2 soon after the compiling phase of the very first .cpp file. The missing symbols are defined in other .cpp files in the same dir.
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/as -arch x86_64 -force_cpusubtype_ALL -o /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccSUmHal.o /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccn8ex81.s
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.8.3 -weak_reference_mismatches non-weak -o Calcoli.o -lcrt1.10.6.o -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/x86_64 -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1 -L/usr/llvm-gcc-4.2/bin/../lib/gcc -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/../../.. -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/../../.. /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccSUmHal.o -lstdc++ -lSystem -lgcc -lSystem
The compiler output ends with the "classic" undefined symbol issue. All emphasized text*emphasized text*emphasized text
Undefined symbols for architecture x86_64:
"typeinfo for TipoPuntoCalc", referenced from:
Calcoli::setPuntoS(GTGraphicObject*) in ccSUmHal.o
"typeinfo for TipoPali", referenced from:
Calcoli::setPaloS(GTGraphicObject*) in ccSUmHal.o
"typeinfo for TipoRett", referenced from:
Calcoli::setFondazioneS(GTGraphicObject*) in ccSUmHal.o
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [Calcoli.o] Error 1
This shouldn't be an architecture related issue, since specifing i386 as target has the same result (symbol(s) not found for architecture i386).
Thank you,
Evelina
Go to your target's "Build Phases" section and verify that all the files you need to compile and link are actually included in the proper sections.
It sounds as if the compiler is not being told to include some things you need.

Apple Mach-O Linker (Id) Error using gSOAP

I´m really stuck with this issue... and i hope you can help me out here.
I'm developing an iPad app for a company, that requires to use secured SOAP web services... not the perfect combination! i know, the thing is that taking a look around google, i found that the "best" thing to do was making a WS client using gSOAP and that´s what i did! now i have the client for one of those WS in C++.
When i try to call one of the methods of the WS, and build the app... this is what happens:
Ld /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App normal i386
cd /Users/me/iOS/App
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
-L/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator
-L/Users/me/iOS/App -F/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks
-filelist /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100
-framework SenTestingKit -framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -ldataSOAPlibDev
-o /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App
ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a,
file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
'soap::soap()', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'_soap_init_LIBRARY_VERSION_REQUIRED_20808', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'soap_call_ns1__obtenerPais(soap*, char const*, char const*, ns2__paisFile*,
ns1__obtenerPaisResponse&)', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'soap::~soap()', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'ns2__paisFile::soap_default(soap*)', referenced from:
ns2__paisFile::ns2__paisFile() in ViewContratosController.o
'vtable for ns2__paisFile', referenced from:
ns2__paisFile::ns2__paisFile() in ViewContratosController.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The NOTE may tell the problem... but i don´t know how to solve it... any ideas?
Thanks!
The problem is probably that you took a library for iPAd (ARM architecture) and tried to build to the simulator (i386 architecture). Try building to the actual device instead.
The hint for me was:
ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a, file
was built for archive which is not the architecture being linked
(i386)
OK! i solved it including (not importing) the headers and the nsmap generated by gSOAP in the .mm file where i´m trying to consume the WS...
#include "soapH.h"
#include "soapStub.h"
#include "soapdataServiceSoapBindingProxy.h"
#include "dataServiceSoapBinding.nsmap"
If you are going to make a static library out of a WS Client created by gSOAP, be REALLY careful with the "Build Phases" of the library Project... add carefully the headers and the compile sources!
After that... import to your iOS proyect the "lib.a" with the headers and the XMLs under the same folder! and call the WS doing something like this:
dataServiceSoapBinding service;
ns2__countryFile country;
struct ns1__getCountryResponse response;
country.idCountry = 11;
if(service.ns1__getCountry(&country, response) == SOAP_OK) {
NSLog(#"ok");
} else {
NSLog(#"ERROR");
}
I hope this may help anybody... because i had such a hard time figuring this out... and didn´t find much info about it!
:)