Hi, my C++ program is just these few lines:
/****************
* Helloworld.cpp
*****************/
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s = "Hell! O' world, why won't my c++ code run?\n\n";
cout << s;
return 0;
}
The program runs okay on the router board if just printf is used. But once I
switch to use string and cout I get the "Illegal instruction" error.
BTW what is inline asm? Thank you.
Chiang
----- Original Message ----
> From: Conrad Meyer <[EMAIL PROTECTED]>
> To: OpenWrt Development List <[email protected]>
> Sent: Thursday, 4 September, 2008 20:19:17
> Subject: Re: [OpenWrt-Devel] "Illegal instruction" from running a simple C++
> program
>
> Quoth Chiang Kang Tan:
> > Hi all,
> >
> > I'm trying to cross compile a simple helloworld C++ program onto my xscale
> router board. So far I've no problem cross compiling C programs to run on my
> router board. But once I try to run C++ programs on the router board, that
> is "successfully" cross compiled, I receive this "Illegal instruction" error.
> I've spent a fair bit of time trawling the Internet but nobody seems to be
> reporting having this problem. So hopefully this is just a simple error I've
> overlooked that someone on this mailing list can point me to the right
> direction to get me started on how to cross compile C++ programs for OpenWrt.
> >
> > FYI, I'm using the OpenWrt-SDK-ixp4xx-2.6-for-Linux-i686 SDK to do the
> > cross
> compiling and I have been following this tutorial,
> http://www.gargoyle-router.com/openwrt-coding.html, with success up till this
> point.
> >
> > Thank you in advance.
> >
> > Regards,
> >
> > Chiang
>
> Looks like GCC is targeting the wrong cpu OR your C++ program has some inline
> asm. (I'd look for the inline asm first.)
>
> Regards,
> --
> Conrad Meyer
_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel