Linkingproblem with Framework in Xcode

K

ketchupok

Neues Mitglied
Thread Starter
Dabei seit
16.02.2011
Beiträge
5
Reaktionspunkte
0
Hi,

ich hab folgendes Problem, mit dem ich einige Stunden rumgeschlagen habe aber keine Lösung finde:
Ich möchte ein Programm was ich bisher im Terminal compiliert habe als XCode Projekt wandeln. Wenn ich die Datei im Term kompiliere funktioniert alles.

Code:
g++-4.0 example10.cpp -o example10 
 -I/Library/Frameworks/CsoundLib.framework/Versions/Current/Headers 
 -framework CsoundLib -> automaticly by dragging
 -L/Library/Frameworks/CsoundLib.framework/Versions/Current/ 
 -l_csnd

Wenn ich das versuche in den XCode Einstellungen umzusetzen, bekomme ich die Flags nicht in diese Reihenfolge. Außerdem beschwert sich der Linker immer über Undefined Symbols.

Code:
/Developer/usr/bin/g++-4.0 -arch i386 -L/Users/pinguin/Desktop/example10csound/build/Release -L/Library/Frameworks/CsoundLib.framework/Versions/Current -F/Users/pinguin/Desktop/example10csound/build/Release -filelist /Users/pinguin/Desktop/example10csound/build/example10csound.build/Release/example10csound.build/Objects-normal/i386/example10csound.LinkFileList -framework CsoundLib -o /Users/pinguin/Desktop/example10csound/build/example10csound.build/Release/example10csound.build/Objects-normal/i386/example10csound

ld: warning: directory '/Users/pinguin/Desktop/example10csound/build/Release' following -L not found
ld: warning: directory '/Users/pinguin/Desktop/example10csound/build/Release' following -F not found
Undefined symbols:
  "CsoundPerformanceThread::Play()", referenced from:
      _main in main.o
  "CppSound::getCsound()", referenced from:
      _main in main.o
  "CsoundPerformanceThread::Pause()", referenced from:
      _main in main.o
  "CppSound::~CppSound()", referenced from:
      _main in main.o
  "CsoundFile::exportForPerformance() const", referenced from:
      _main in main.o
  "CsoundPerformanceThread::~CsoundPerformanceThread()", referenced from:
      _main in main.o
  "CsoundPerformanceThread::CsoundPerformanceThread(CSOUND_*)", referenced from:
      _main in main.o
  "CppSound::CppSound()", referenced from:
      _main in main.o
  "CppSound::compile()", referenced from:
      _main in main.o
  "CsoundFile::setCSD(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
      _main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Danke!
K.
 
warum hast du denn
-L/Users/pinguin/Desktop/example10csound/build/Release
und
-F/Users/pinguin/Desktop/example10csound/build/Release
mit drin?
in deinem Xcode projekt sind die also nicht korrekt und nicht gleich deiner terminal zeile...
 
Ja, das hatte sich aus versehen ergeben. Aber auch ohne diese läuft es leider nicht..

Code:
Ld build/Release/example10csound normal i386
cd /Users/pinguin/Desktop/example10csound
/Developer/usr/bin/g++-4.0 -arch i386 -L/Users/pinguin/Desktop/example10csound/build/Release -L/Library/Frameworks/CsoundLib.framework/Versions/Current -F/Users/pinguin/Desktop/example10csound/build/Release -filelist /Users/pinguin/Desktop/example10csound/build/example10csound.build/Release/example10csound.build/Objects-normal/i386/example10csound.LinkFileList -framework CsoundLib -o /Users/pinguin/Desktop/example10csound/build/Release/example10csound

Undefined symbols:
  "CsoundPerformanceThread::Play()", referenced from:
      _main in main.o
  "CppSound::getCsound()", referenced from:
      _main in main.o
  "CsoundPerformanceThread::Pause()", referenced from:
      _main in main.o
  "CppSound::~CppSound()", referenced from:
      _main in main.o
  "CsoundFile::exportForPerformance() const", referenced from:
      _main in main.o
  "CsoundPerformanceThread::~CsoundPerformanceThread()", referenced from:
      _main in main.o
  "CsoundPerformanceThread::CsoundPerformanceThread(CSOUND_*)", referenced from:
      _main in main.o
  "CppSound::CppSound()", referenced from:
      _main in main.o
  "CppSound::compile()", referenced from:
      _main in main.o
  "CsoundFile::setCSD(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
      _main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
 
hast du das framework auch links in die frameworks/linked frameworks gezogen?
 
Hi, One danke für deine Hilfe!

Ich hatte es mit Add->ExistingFrameworks zum Projekt hinzugefügt. Es taucht direkt als erstes noch vor dem Source in der Liste auf. Gibt es noch einen anderen Punkt für frameworks/linked?
 
wenn es dort irgendwo links steht sollte der das schon finden.
es sei denn, du hast irgendwas in der info der targets verstellt.
 
Danke.. ich bastel mal weiter rum, wenns läuft melde ich mich woran's lag.
 
Ok, ich habs gefunden.
Dein Tip, dass mit dem Linking richtig zu machen, war gut! Ich hatte mir dazu nochmal das XCode 3 tutorial durchgelesen und noch einen Formfehler beim Einbinden der Header gefunden. (unter hilfe:Framework ProgrammingGuide: Including Frameworks)

#include <Framework_name/Header_filename.h>

Was außerdem falsch war, war das -l_csnd Flag. Das hatte ich bei "other c++ flags". Jetzt habe ich es in die Linkersektion unter "Symbol ordering Flags" und nun läufts.
 
Zurück
Oben Unten