{"id":276,"date":"2008-05-15T11:37:58","date_gmt":"2008-05-15T11:37:58","guid":{"rendered":"http:\/\/blog.cyberwizzard.nl\/?p=276"},"modified":"2016-03-17T21:24:21","modified_gmt":"2016-03-17T20:24:21","slug":"matlab-and-c","status":"publish","type":"post","link":"https:\/\/blog.cyberwizzard.nl\/?p=276","title":{"rendered":"Matlab and C++"},"content":{"rendered":"<p>Wouldn&#8217;t it be cool to use native code in Matlab? You can ^-^. <\/p>\n<p align=\"left\">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!<\/p>\n<p align=\"left\">This is the crap you would see:<\/p>\n<pre># gcc test.cpp<br \/>\/tmp\/ccrnZKfr.o: In function `__static_initialization_and_destruction_0(int, int)':<br \/>test.cpp:(.text+0x23): undefined reference to `std::ios_base::Init::Init()'<br \/>\/tmp\/ccrnZKfr.o: In function `__tcf_0':<br \/>test.cpp:(.text+0x66): undefined reference to `std::ios_base::Init::~Init()'<br \/>\/tmp\/ccrnZKfr.o: In function `main': test.cpp:(.text+0x76):<br \/>undefined reference to `std::cout' test.cpp:(.text+0x7b):<br \/>undefined reference to `std::basic_ostream&lt;char, char_traits&lt;char&gt; &gt;& std::operator&lt;&lt; &lt;std::char_traits&lt;char&gt; &gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&, char const*)'<br \/>\/tmp\/ccrnZKfr.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'<br \/>collect2: ld returned 1 exit status<\/pre>\n<p>&nbsp;<\/p>\n<p align=\"left\">The guide I found even explains how to make a small Makefile to speed up the process of compiling (and testing). The (short) guide <a href=\"http:\/\/webusers.npl.uiuc.edu\/~yangrz\/Make.html\" target=\"_blank\">is here<\/a>.<\/p>\n<p align=\"left\">Right now I&#8217;m waiting for Matlab to finish installing and then I&#8217;ll try to test my Hello World from within Matlab. More info how that works can be <a href=\"http:\/\/www.ocgy.ubc.ca\/~yzq\/books\/matlab+C.htm\" target=\"_blank\">found here.<\/a><\/p>\n<div class=\"bleezer-tags:Matlab, C++, Matlab plugin\">\n<p style=\"font-size: 10px; text-align: right\">Technorati: <a href=\"http:\/\/www.technorati.com\/tag\/Matlab\" rel=\"tag\">Matlab<\/a> <a href=\"http:\/\/www.technorati.com\/tag\/C++\" rel=\"tag\">C++<\/a> <a href=\"http:\/\/www.technorati.com\/tag\/Matlab+plugin\" rel=\"tag\">Matlab plugin<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Wouldn&#8217;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. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[40,199,203,152,176,196,202,460,459,201,200,84],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-programming","tag-and","tag-atest","tag-code","tag-cool","tag-latest","tag-matlab","tag-native","tag-no_ok","tag-not_ok","tag-use","tag-wouldn","tag-you"],"views":1332,"_links":{"self":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276"}],"version-history":[{"count":1,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":454,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions\/454"}],"wp:attachment":[{"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cyberwizzard.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}