Forums > Dev

C++ external first steps help

March 28, 2012 | 9:38 am

hello,

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

http://code.google.com/p/maxcpp/

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

Pierre


March 29, 2012 | 1:54 pm

Hello,

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…

:s

hard…


March 29, 2012 | 2:06 pm

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)

anyone?


March 29, 2012 | 2:27 pm

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…

Pierre


March 29, 2012 | 2:28 pm

thank you vanille, i will look at commonsyms.c


March 30, 2012 | 5:34 am

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?

Pierre


March 30, 2012 | 6:42 am

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


April 2, 2012 | 11:12 am

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

http://cycling74.com/forums/topic.php?id=37152

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


April 12, 2012 | 11:25 am

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:

http://www.eecs.qmul.ac.uk/~andrewr/software/simplecplusplus.zip

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


April 12, 2012 | 2:17 pm

great,I will try that!

thank you a lot

Pierre


February 6, 2014 | 10:33 am

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 !


Viewing 11 posts - 1 through 11 (of 11 total)