eceng
Posts: 2
Joined: Sat Aug 22, 2015 9:54 pm

C++11 cross compile with eclipse

Sat Aug 22, 2015 10:38 pm

Hi every one,

I am trying to compile a simple c++11 code for Pi2 using Eclipse with my linux host machine,

Code: Select all

#include <iostream>
#include <thread>
using namespace std;

void call_from_thread(){
	std::cout <<"Hello, Am Thread"<<std::endl;
}

int main() {

	std::thread t1(call_from_thread);
	//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!

	t1.join();
	return 0;
}
I have added -std=c++11 and -pthread flags, but i get the following error

Code: Select all

pure virtual method called
terminate called without an active exception
Aborted
logout
am using arm-linux-gnueabihf-g++-4.8 tool chain to cross compile and RPi is running Raspbian Wheezy.

eceng
Posts: 2
Joined: Sat Aug 22, 2015 9:54 pm

Re: C++11 cross compile with eclipse

Tue Aug 25, 2015 9:10 pm

Solved it by using the cross compiler provided on raspberry github page https://github.com/raspberrypi/tools

User avatar
yasriady
Posts: 27
Joined: Wed Apr 08, 2015 2:37 am
Location: Indonesia
Contact: Website

Re: C++11 cross compile with eclipse

Mon Oct 19, 2015 5:28 am

Hi,
I use this way http://yasriady.blogspot.co.id/2015/10/ ... ry-pi.html
The toolchain was generated by buildroot, and it automated to build other libs like X11, GTK, and more c++ libs ...
MyRaspberryPi : Cross Compile, wxWidgets/C++ and Linux Journal at http://yasriady.blogspot.com

Return to “C/C++”