the use of the #define _cplusplus

    Nov 19 2009 | 6:06 pm
    I am experimenting making external in c++ with the max external...
    Up until now I was encapsulating my main function in a extern "C" {}.. but I realize that alot of the cycling74 header have a if def _cplusplus... So does this means that if I do #define _cplusplus in before all my includes I don't need to put my main in an extern "C" block? Of course I'll only use c++ function in my main...
    thks alot

    • Nov 20 2009 | 3:05 pm
      There is a C++ example in the SDK called "collect", which you may find helpful.
      You do not need to define the c++ preprocessor symbol -- compilers set this automatically and if you change it then it could cause you trouble down the road.
    • Nov 20 2009 | 7:49 pm
      Wow thanks you are right!
      it is because I didn't like to put all my software in an extern "C" block so i did
      namespace C74
         // Max includes
         extern "C"
            #include "ext.h"   // standard Max include, always required
            #include "ext_obex.h" // required for new style Max object
            #include "ext_strings.h"
            #include "ext_common.h"
            #include "commonsyms.h"
      }; // namespace MaxMspJitter
      and it all seam to work!
      thanks alot!
    • Nov 23 2009 | 1:53 pm
      The Cycling-provided header files (ext.h and friends) should have all of the extern "C" work done for you already, so there really isn't any need for you to do it manually.
      Cheers, Tim