C++ external first steps help


    Mar 28 2012 | 9:38 am
    hello,
    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
    Pierre

    • Mar 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...
    • Mar 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?
    • Mar 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
    • Mar 29 2012 | 2:28 pm
      thank you vanille, i will look at commonsyms.c
    • Mar 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
    • Mar 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
    • Apr 02 2012 | 11:12 am
      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 | 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:
      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.
    • Apr 12 2012 | 2:17 pm
      great,I will try that!
      thank you a lot
      Pierre
    • Feb 06 2014 | 6:33 pm
      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 !
    • Oct 20 2014 | 11:20 pm
      hope it's okay to reply here, but if you ever get something like:
      parse error, unknown type class
      it's because there's a mix and match of
      myexternalobject.c
      and .cpp code being added
      hopefully the (t_class*) cast idea above works out for anyone doing c++ externals. you could of course use faust to do this