Categories
Programming

Matlab and C++

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.

Technorati:

Categories
Japan Blog Study Tour

Universities and cool labs

IMG_3313 This morning we checked out of the Tsukuba Daily Inn after having a mixed style breakfast: it was not really Japanese because they had bread and it wasn’t really Western style because it had Japanese cabbage as well. We hopped on a bus back to Tsukuba Center and then on a bus to the Tsukuba University. Because of some miscommunication and some idiots we got off way too early and walked for 35 minutes until we finally found the right building (a campus for 17,000 students is huge, whoever came up with the idea that we should walk should be shot).