如何在XCode中指定-D__MACOSX_CORE__

时间:2012-02-05 15:39:13

标签: c++ xcode compiler-construction

我正在开发一个使用RtMidi(http://www.music.mcgill.ca/~gary/rtmidi/)的项目。我可以使用以下命令在终端中编译示例代码。

g++ -Wall -D__MACOSX_CORE__ -o midiprobe midiprobe.cpp RtMidi.cpp \
    -framework CoreMidi -framework CoreAudio -framework CoreFoundation

但是,我需要使用XCode中的代码。我添加了三个框架CoreMidi,CoreAudio和CoreFoundation,但我不知道如何处理-D__MACOSX_CORE __。

错误:

Undefined symbols for architecture x86_64:   "vtable for RtMidiIn",
referenced from:
       RtMidiIn::RtMidiIn(std::string, unsigned int) in RtMidi.o   "RtMidiIn::initialize(std::string const&)", 
referenced from:
       RtMidiIn::RtMidiIn(std::string, unsigned int) in RtMidi.o   "vtable for RtMidiOut",
referenced from:
       RtMidiOut::RtMidiOut(std::string) in RtMidi.o   "RtMidiOut::initialize(std::string const&)",
referenced from:
       RtMidiOut::RtMidiOut(std::string) in RtMidi.o
ld: symbol(s) not found for architecture x86_64 clang:
error: linker command failed with exit code 1 (use -v to see invocation)

有人可以帮我吗?

1 个答案:

答案 0 :(得分:2)

进入目标的构建设置,然后创建一个值为__MACOSX_CORE__的预处理器宏。

enter image description here