2009-10-04 1 views
0

Всякий раз, когда я пытаюсь скомпилировать приложение для iPhone, которое я портирую, я получаю ошибки связывания. Приложение использует скриптовый язык Squirrel (для чтения файлов уровня, отлично с помощью SDK, без ввода пользователем). Я связал все библиотеки, включая libsquirrel.a. Что я делаю не так? (приложение SuperTux, исходный код на supertux.lethargik.org для компьютерной версии).Символы не обнаружены при подключении приложения iPhone в Xcode

Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_12AmbientSoundEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_12ThunderstormEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_13DisplayEffectEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_14ScriptedObjectEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_4TextEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_4WindEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_6CameraEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_6CandleEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_6PlayerEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_7SSectorEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_7TileMapEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_8PlatformEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_9LevelTimeEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_9WillOWispEb", referenced from: 
Line Location Tool:0: "__ZN9Scripting25register_supertux_wrapperEP4SQVM", referenced from: 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_12AmbientSoundEEEvP4SQVMiPT_RKSsb in ambient_sound.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_12ThunderstormEEEvP4SQVMiPT_RKSsb in thunderstorm-02078462.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_13DisplayEffectEEEvP4SQVMiPT_RKSsb in display_effect.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_14ScriptedObjectEEEvP4SQVMiPT_RKSsb in scripted_object.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_4TextEEEvP4SQVMiPT_RKSsb in text_object.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_4WindEEEvP4SQVMiPT_RKSsb in wind-9E10B675.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_6CameraEEEvP4SQVMiPT_RKSsb in camera-A3560D66.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_6CandleEEEvP4SQVMiPT_RKSsb in candle-06462D68.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_6PlayerEEEvP4SQVMiPT_RKSsb in player.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_7SSectorEEEvP4SQVMiPT_RKSsb in sector.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_7TileMapEEEvP4SQVMiPT_RKSsb in tilemap-8DC8046A.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_8PlatformEEEvP4SQVMiPT_RKSsb in platform-E187A570.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_9LevelTimeEEEvP4SQVMiPT_RKSsb in level_time-2C8E1157.o 
Line Location Tool:0: __ZN9Scripting13expose_objectINS_9WillOWispEEEvP4SQVMiPT_RKSsb in willowisp.o 
Line Location Tool:0: __ZN9Scripting13init_squirrelEb in squirrel_util.o 
Line Location Tool:0: collect2: ld returned 1 exit status 
Line Location Tool:0: symbol(s) not found 

Когда я посмотрел на выходе сборки:

Ld "/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/Debug-iphonesimulator/SuperTux.app/SuperTux" normal i386 
    cd "/Users/Thomas/Documents/iPhone Dev Projects./SuperTux" 
    setenv MACOSX_DEPLOYMENT_TARGET 10.5 
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk "-L/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/Debug-iphonesimulator" "-L/Users/Thomas/Documents/iPhone Dev Projects./SuperTux" "-L/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/../../../Library/Frameworks/SDL.framework/Headers" "-L/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/../../../Downloads/SQUIRREL2/lib" -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1 "-F/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/Debug-iphonesimulator" "-F/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/../../../Library/Frameworks" "-F/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/../../../Downloads" "-F/Users/Thomas/Documents/iPhone Dev Projects./SuperTux" -F/Applications/SuperTux.app/Contents/Frameworks "-F/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/../../../Desktop/SDL2" -filelist <b>"/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/SuperTux.LinkFileList" -Wl,--no-demangle -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework SDL_image -framework Ogg -framework Vorbis -lSDLSimulator -lSDLiPhoneOS -framework SDL -framework OpenAL -lphysfsdevice "/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/English.lproj/lphysfssimulator.a" -loggdevice -loggsim -lSDL_imagedevice -lSDL_imagesim -lvorbisdevice -lvorbisencdevice -lvorbisfiledevice -lvorbisencsim -lvorbisfilesim -lvorbissim -lminiswigdevice -lminiswigsim -lsqstdlib -framework SDL_mixer -framework SDL_image -lSDL_mixer -lSDL_mixersim -lstdc++-static -lstdc++ -lz -lSDLmain -framework CoreGraphics -framework CoreAudio -framework AudioToolbox -lsquirrelsim -lsquirreldevice -prebind -o "/Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/Debug-iphonesimulator/SuperTux.app/SuperTux"</b> 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libSDLiPhoneOS.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libphysfsdevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/liboggdevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libSDL_imagedevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libvorbisdevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libvorbisencdevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libvorbisfiledevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libminiswigdevice.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libSDL_mixer.a, file is not of required architecture 
ld warning: in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libsquirreldevice.a, file is not of required architecture 
ld warning: __ZTVSt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(stdexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
ld warning: __ZTISt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(stdexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
ld warning: __ZTSSt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(stdexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
ld warning: __ZTISt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(functexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
ld warning: __ZTVSt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(functexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
ld warning: __ZTSSt11range_error has different visibility (hidden) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/libstdc++-static.a(functexcept.o) and (default) in /Users/Thomas/Documents/iPhone Dev Projects./SuperTux/build/SuperTux.build/Debug-iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

Что-то странное может быть происходит с libstdC++ - static.a. Даже не уверен, что это такое.

ответ

8

C++ ФИЛТР ваш друг будет unmangle эти имена, чтобы показать вам, что отсутствует:

> c++filt __ZN9Scripting24create_squirrel_instanceEP4SQVMPNS_12AmbientSoundEb 
Scripting::create_squirrel_instance(SQVM*, Scripting::AmbientSound*, bool) 

Первая строка сверху, кажется, указывает, что он не может найти определение метода create_squirrel_instace из класса Scripting.

Значит, порядок, который библиотеки представляют g ++ (который является компилятором, используемым на Mac), важен. Так что посмотрим на выходе сборки и посмотреть, если вы можете найти строку, в которой связаны библиотеки:

Он должен выглядеть следующим образом:

g++ <STUFF> -l<lib1> -l<lib2> etc. 

Я reformated выход abovre так читаем: в тексте я заменить

/Users/Thomas/Documents/iPhone Dev Projects./SuperTux с <DIR>, чтобы помочь читаемости:

целая куча библиотек не используются becuase они неправильно архитектура:

ld warning: in <DIR>/SuperTux/libSDLiPhoneOS.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libphysfsdevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/liboggdevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libSDL_imagedevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libvorbisdevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libvorbisencdevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libvorbisfiledevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libminiswigdevice.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libSDL_mixer.a, 
file is not of required architecture 

ld warning: in <DIR>/SuperTux/libsquirreldevice.a, 
file is not of required architecture 

Тогда у вас также есть некоторые предупреждения, вы должны смотреть на:

ld warning: __ZTVSt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(stdexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

ld warning: __ZTISt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(stdexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

ld warning: __ZTSSt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(stdexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

ld warning: __ZTISt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(functexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

ld warning: __ZTVSt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(functexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 

ld warning: __ZTSSt11range_error 
has different visibility 
(hidden) in <DIR>/SuperTux/libstdc++-static.a(functexcept.o) 
and (default) in <DIR>/SuperTux/build/SuperTux.build/Debug iphonesimulator/SuperTux.build/Objects-normal/i386/font.o 
+0

я не знаю, C++ ФИЛТР существует. это отлично. К сожалению, ошибки ссылок в Xcode еще не используют его –

+0

Неиспользуемые библиотеки имеют смысл; Я построил все библиотеки дважды - один раз для устройства и один раз для симулятора. Странные предупреждения исчезают после удаления libstdC++ - static.a. Должно быть, случайно связали его. Спасибо за помощь, кстати. Ошибки все еще существуют. – Firestar