[PD] pd external c++ example

Joseph Larralde joseph.larralde at gmail.com
Sun Jun 3 15:40:40 CEST 2018


Hi list,

Some time ago I wrote a bunch of pd externals in C++, some using flext, 
some by tweaking xcode projects until they worked.
Yesterday I've been trying the examples from the 
pure-data/externals-howto github repo, with the idea in mind to write my 
own clean pd library.
The first example compiled right away, so I decided to tweak it to use 
C++ instead of C.

Here is what I did :
- rename helloworld.c to helloworld.cpp
- surround the whole code with extern "C" { ... }
- change class.sources = helloworld.c to class.sources = helloworld.cpp 
in the Makefile.

And I got this error :
/Applications/Pd-0.47-1-64bit.app/Contents/Resources/src/m_pd.h:476:17: 
note:
       candidate function not viable: no known conversion from 'int' to
       't_atomtype' for 6th argument
EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod,

I tried to add CXX = g++, then CXX = clang, then CXX = llvm in the 
Makefile, none of which changed anything.
(I'm using OSX 10.11.6)

Before starting to play with more settings I don't fully understand 
everywhere, I thought I'd ask for help here.
Any suggestions ?
By the way, I think a basic C++ example in the repo would be useful.

Also, if some advanced user is able to give me a good reason to 
(cross-compatibility or whatever), I could consider switching back to C.
But I don't see any reason to do so, except maybe for a small gain in 
size and/or performance ...

Thank you in advance for any replies,
Joseph




More information about the Pd-list mailing list