Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify -D__MACOSX_CORE__ in XCode

Tags:

c++

xcode

I am working on a project that uses RtMidi (http://www.music.mcgill.ca/~gary/rtmidi/). I can compile the example codes in terminal using the command below.

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

However, I need to use the codes in XCode. I added the three frameworks CoreMidi, CoreAudio and CoreFoundation, but I don't know what to do with -D__MACOSX_CORE__.

Errors:

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)

Can anyone help me on this?

like image 386
Ruofeng Avatar asked Oct 16 '25 16:10

Ruofeng


1 Answers

Go into your target's Build Settings and and create a Preprocessor Macro with the value __MACOSX_CORE__.

enter image description here

like image 114
SSteve Avatar answered Oct 18 '25 07:10

SSteve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!