Wouldn’t it be cool to use native code in Matlab? You can ^-^.
I started out by writing a small hello world program to test C++ but every time I ran it against GCC I got funky errors. After a while I found out why: g++ is the C++ compiler, GCC only does old-skool C. D0h!
This is the crap you would see:
# gcc test.cpp
/tmp/ccrnZKfr.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccrnZKfr.o: In function `__tcf_0':
test.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccrnZKfr.o: In function `main': test.cpp:(.text+0x76):
undefined reference to `std::cout' test.cpp:(.text+0x7b):
undefined reference to `std::basic_ostream<char, char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccrnZKfr.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
The guide I found even explains how to make a small Makefile to speed up the process of compiling (and testing). The (short) guide is here.
Right now I’m waiting for Matlab to finish installing and then I’ll try to test my Hello World from within Matlab. More info how that works can be found here.