gpt4 book ai didi

c++ - 如何在 XCode 中指定 -D__MACOSX_CORE__

转载 作者:太空狗 更新时间:2023-10-29 21:49:06 25 4
gpt4 key购买 nike

我正在开发一个使用 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)

谁能帮我解决这个问题?

最佳答案

进入目标的build设置并创建一个预处理器宏,其值为 __MACOSX_CORE__

enter image description here

关于c++ - 如何在 XCode 中指定 -D__MACOSX_CORE__,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9150496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com