c++ - Statically link framework to an Xcode command line tool -


i mac user running 10.10.5 yosemite , xcode 6.3.2. in documents there folder (generated command line tool project written in c++) called 'game' structure:

game:       game.xcodeproj (my project)       game:           main.cpp (my c++ source)       build:           products:                   debug:                         game (an executable)                         sdl2.framework (a development library) 

i want link sdl2.framework in build/products/debug in such way run on mac, specific folder.

i have performed these steps:

i dragged sdl2.framework build/products/debug project navigator. unchecked 'copy if needed.'

this automatically added 'link binary libraries' build phase in sdl2.framework included.

sdl2.framework referenced relative group- in 'build/products/debug/sdl2.framework,' desired.

in main.cpp write:

 # include "sdl2/sdl.h" 

the generated executable runs on machine no matter 'game' folder highest in hierarchy is.

my project not referencing sdl2.framework in /library/frameworks. can change name of sdl2.framework there , program still runs. suggests taking /build/products/debug want to.

however, when take whole folder onto mac identical mine executable runs, fails error:

  last login: sat mar 26 11:32:08 on ttys002   [~/ 1> /volumes/no\ name/game/build/products/debug/game ; exit;   dyld: library not loaded: @rpath/sdl2.framework/versions/a/sdl2   referenced from: /volumes/no name/game/build/products/debug/game   reason: image not found   trace/bpt trap   logout    [process completed] 

having spent hours searching solution, dumbfounded. doing wrong?


Comments