C++ external first steps help

Mar 28, 2012 at 9:38am

C++ external first steps help


this morning i’ve test to make a C++ external with maxcpp ( in order to use Gecode later…)


i’ve copy the maxcpp5.h in my xcode project (C++ command line tool)
i’ve include it to main.cpp

but when i try to compile the first exemple Xcode apparently don’t find “ext.h”
that’s weird because i’ve add MaxAPI.framework to my project…

if anyone has a hint for me it will be welcome :)

i’m not a high level developer so… be kind to me plz


Mar 28, 2012 at 4:19pm


for me it comes from the maxmspsdk.xconfig … headers/frameworks path are not defined well in the project with it …

try that instead :

// Per architecture and deployment settings
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk

it compiles fine after ;

I’m os X.4.11 / Xcode 2.5 ; and You ?

  1. maxmspsdk.xcconfig
Mar 29, 2012 at 1:54pm


thank you a lot vanille

I’m os X.7.3 / Xcode 4.3.2 / Max 6.0.4

I can’t compile it, i’ve tried some change but i’m stack on ” #include ” ‘new’ file not found…



Mar 29, 2012 at 2:06pm

ok i’ve fix the ‘new’ thing but there is still issues:

Undefined symbols for architecture i386:
“_common_symbols_init”, referenced from:
MaxCpp5::makeMaxClass(char const*) in dummy++.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Mar 29, 2012 at 2:19pm


don’t have so much time now to explain but a clue : it’s about “commonsyms.c” ;-)

Mar 29, 2012 at 2:27pm

I’m going mad with it…
Does anyone could send me a .xcodeproj of a simple C++ external? It would be really nice :)
I think it will be the best solution…


Mar 29, 2012 at 2:28pm

thank you vanille, i will look at commonsyms.c

Mar 29, 2012 at 5:34pm


“commonsyms.h” …

Does anyone could send me a .xcodeproj of a simple C++ external ?

IMHO it will be the same ; as you are struggling with “Headers/Library/Framework search paths” ; that’s a pity but you have to deal with that ;-) I spend long time at the beginning to understand how to do it fine with XCode.

1. Look at “Headers Search Paths” “Library Search Paths” “Framework Search Paths” in / “Project” / “Edit Active Target …” You must have something set ; double-click on the setting ; it must have “$(inherited)” ; that means that it uses maxmspsdk.xconfig values :


2. Be sure that the “maxcpp” folder is ONE level inside your maxSDK5.1.7 folder ; the location of your folder is important as XCode use :

C74SUPPORT = $(SRCROOT)/../../c74support

Mar 30, 2012 at 5:34am

great explainations , i think it will help me
I use maxcpp with max 6 SDK , is it possible or am I suppose to use it with max 5 SDK?


Mar 30, 2012 at 6:10am


AFAIK It should be compatible with max 6 SDK ; but i don’t know if it can be done without any changes.
Maybe use the maxmspsdk.xconfig from those SDK and try …

You should implement a “dummy” external in C first to understand all the mechanisms of linkers (and Xcode’s menus) before to go with C++ … My 2 cents.

Mar 30, 2012 at 6:42am

i was finaly able to compile it, i’ve made a really stupid mistake (that i will keep secret) but now it works :)

just a little question:

is it possible to add methods that don’t need selector?
example.mxo “doesn’t understand” int or float without selector

thank you a lot for your time vanille, you are the only one who help me, i really appreciate
I have work on C external yesterday and lot of things are more clear now ( i’ve reread the begining of the SDK :) …. )

I really need to use Gecode that’s why i’m going C++ now, i’ve start C only 2 weeks ago and even if i’m working hard it takes time to become “natural” and it takes even more time with C++ that’s looks harder than C!!! so excuse the noobish questions plz…

have a good day

Mar 30, 2012 at 11:07am


i can not help you for C++ as i’m not very used with it (and to be honest i don’t like it) ; i’m not sure C++ is “harder” than C ; but the fact is that almost all tutorials/book about this language expect people to know C (even if they claim the contrary).

1. What do you mean by “selector” ?
2. I’m not sure you need to use maxCpp to use Gecode in a maxMSP external … and there is a Python wrapper for Gecode ;-)

Apr 2, 2012 at 11:12am

For int and float register_method, I posted an answer here :


I also have an open question here, http://cycling74.com/forums/topic.php?id=39039

Apr 12, 2012 at 11:25am

you can make C++ external a different way:

1. change :
if (x = (t_simplemax *)object_alloc((t_class *) simplemax_class)) {
//add in pointer to t_class for c plus plus – only line changed!

this is in the new declaration at the bottom of the file. So you are forcing simplemax_class to be a t_class pointer. Somehow this allows you to use C++ now instead of C in your code.

2. change: simplemax.c to simplemax.cpp

3. compile!

my Xcode project is downloadable at:


I’ve done a few things in C++ – using classes etc and never had any problems. Thanks Jeremy Bernstein for the tip.

Apr 12, 2012 at 2:17pm

great,I will try that!

thank you a lot


Feb 6, 2014 at 10:33am

Hi all,

I think I’m having the same trouble as FREEPOULITE,

I’m in OSX 10.9, Xcode 5.0.2, maxcpp6.h

I get this compile error:
Undefined symbols for architecture x86_64:
“_common_symbols_init”, referenced from:
MaxCpp6::makeMaxClass(char const*) in maxcpp-test.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

anyone can help ?

thanks !


You must be logged in to reply to this topic.