Git Product home page Git Product logo

ev3dev-lang-cpp's Introduction

C++ language bindings for ev3dev

Build Status

Compiling

  • EV3:
mkdir build
cd build
cmake .. -DEV3DEV_PLATFORM=EV3
make
  • BrickPi:
mkdir build
cd build
cmake .. -DEV3DEV_PLATFORM=RPI
make

You have several options for compiling.

Cross-compiling

You can use a cross-compiling toolchain to create ARM compatible code. Note: You need a Linux toolchain, not a "bare-metal" toolchain. If it does not have "linux" in the name, it probably won't work.

Pros: Fastest option. Works on Windows and Mac without a virtual machine.

Cons: Only includes standard libraries - no Debian -dev packages.

Windows

MentorGraphics toolchain (formerly known as CodeSourcery).

Windows 10

Windows 10 supports the Windows Subsystem for Linux which allows us to install and execute the entire compiler toolchain. The steps required to compile native-mode EV3 applications on Windows 10 is as follows:

  1. Be sure that your Windows 10 installation has Windows Subsystem for Linux installed. First make sure Developer Mode is enabled under Settings --> Update & Security --> For developers. Then, go to Control Panel --> Programs and Features --> Turn Windows Feature On/Off and check the box next to Windows Subsystem for Linux (Beta).

  2. Fire up the bash shell by pressing Start Key, type bash and press Enter. This will open up Bash on Ubuntu on Windows.

  3. Install the ARM compiler by typing sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi.

  4. Use git clone to clone this repository to the directory of your choice, e.g.,

git clone https://github.com/ddemidov/ev3dev-lang-cpp.git

will clone the repo into a directory called /ev3dev-lang-cpp.git.

  1. You need to make some changes to the top-level CMakeLists.txt file. First, go into the directory
cd ev3dev-lang-cpp

Now, edit the CMakeLists.txt file with a text editor of your choice, e.g.,

vi CMakeLists.txt

Just after the project(...) declaration, set the C/C++ compilers by adding the following lines:

set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CC_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++")

Alternatively, you can set these environment variables during compilation (explained later).

  1. Now compile your programs and the generated binaries will be ready for EV3. This assumes that you have build tools such as make and cmake installed - if not, install them with sudo apt-get install build-essential (for make) and sudo apt-get install cmake for cmake. You can then perform compilation by invoking the following commands:
mkdir build && cd build
cmake .. -DEV3DEV_PLATFORM=EV3
make

If you did not set the variables in the CMakeLists.txt file, use the following commands instead:

mkdir build && cd build
CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ cmake ..
make
  1. Install gcc-5 from unstable on your EV3, or else files compiled in Windows will not execute. First, on the EV3, edit /etc/apt/sources.list to allow searching for packages in unstable:
sudo vim /etc/apt/sources.list

Append the following lines to the end of the file:

deb http://httpredir.debian.org/debian unstable main contrib non-free
deb http://security.debian.org/ unstable/updates main contrib non-free
deb http://archive.ev3dev.org/debian unstable main

Save and exit. Afterwards, run sudo apt-get update, which will update the packages searched for. Finally, install the new gcc compiler:

sudo apt-get install gcc-5/unstable
  1. The build directory will now contain folders with binary files ready to be executed on the EV3 brick. The easiest way to copy files is to use a program that supports SFTP, such as Filezilla. Remember that, by default, the username of the host system is robot and password is maker. The location of the path where the files are kept on disk is likely the following:
c:\users\<YOUR USERNAME>\appdata\local\lxss\home\<YOUR USERNAME>\ev3dev-lang-cpp\build\

Alternatively, Secure Copy may be used to quickly transfer a few files without having to leave the shell:

scp file.txt <EV3 USERNAME>@<IP>:/destination/directory
  1. Be sure to chmod u+x myprogram for every copied program before running the program, otherwise you'll get an Access Denied in SSH or some really weird error if executing from the brick.

Mac

The Carlson-Minot toolchain provides a complete toolchain for cross-compilation on the Mac. Download the "ARM GNU/Linux G++ Lite 2014.05-29 Easy Installer" and run it.

To get the cross-compilation working, use (replace EV3 by RPI for the BrickPi)

mkdir build
cd build
CC=arm-none-linux-gnueabi-gcc CXX=arm-none-linux-gnueabi-g++  cmake -DCMAKE_SYSTEM_NAME=Linux -DEV3DEV_PLATFORM=EV3 ..
make

Brickstrap

Brickstrap uses QEMU to create a virtual environment (not exactly a virtual machine) that can run the same ARM compatible code on a different type of computer.

Pros: Faster than running on the EV3 itself. Can install all Debian -dev packages using apt-get.

Cons: Slower than cross-compiler. Requires Linux (Ubuntu).

See this page for instructions.

On the Brick

It is possible to compile programs on the EV3 brick itself.

Pros: Easy to setup.

Cons: Really slow.

Just run sudo apt-get install build-essential on the EV3 and you will have everything you need.

ev3dev-lang-cpp's People

Contributors

alexdewar avatar atomicf32 avatar bmegli avatar cho934 avatar ddemidov avatar dlech avatar dsharlet avatar fdetro avatar floydbloke avatar markpeletier avatar nesteruk avatar polarbub avatar simonmicro avatar victorhu3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ev3dev-lang-cpp's Issues

Installation unter Windows 11 schlägt fehlt, Package kann nicht gefunden werden

Der Befehl sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi läuft ins Leere, ich erhalte die Meldung:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package gcc-arm-linux-gnueabi
E: Unable to locate package g++-arm-linux-gnueabi
E: Couldn't find any package by regex 'g++-arm-linux-gnueabi'

Wie und wo finde ich die Pakete?

Herzliche Grüße
Christian

HT-nxt-angle

Hi,

I'm trying to use HT-nxt-angle, but I don't see how to use it using ev3dev-lang-demo or ev3dev-lang-test.
Moreover I saw some issues (ev3dev/ev3dev#555)

Could you please help me ?

can't install gcc-5/unstable

I included all of the sources given in the README in my /etc/apt/sources.list and http://archive.ev3dev.org/debian unstable main
gives me a 404 when running sudo apt update.
sudo apt install gcc-5/unstable says that the package could not be found. Is there any other source where i can get gcc-5 from?

version `GLIBCXX_3.4.21' not found

Hey,

I currently have a problem regarding how to make my C++ programs run on the EV3 dev (lego mindstorm).

When I try to run my program (called driveTest), I get the following error message:

./driveTest: /usr/lib/arm-linux-gnueabi/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./driveTest)

I found a simular issue on askubuntu.com (,) and tried to do as the comments recommended:

sudo apt-get install libstdc++6 (which was already installed)
sudo add-apt-repository ppa:ubuntu-toolchain-r/test (some errors)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

But unfortunately, it did not solve my problem.
I do not know what to do next. Could you please help me?

Problems with executing on brick

I compiled demos on bash windows 10, then i tried to execute it on the EV3(ev3dev) brick, but when i am trying to start some program it says : " /usr/lib/arm-linux-gnueabi/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./button-test) ". I tried to download newest version of gcc, but it's no version higher than gcc-4.9. What to do? I am new on linux.

How to get the MicroInfinity CruizCore XG1300L gyroscope working

I'm trying to use an XG1300L gyroscope attached to my EV3, but I'm not able to get it working in my C++ program. I'm looking for help getting it to connect. I assume I've just missed a simple step, but I cannot figure out where I've gone wrong.

I'm following the example code in the ev3dev-mapping code by bmegli. Specifically, I looked at how he used the gyro in the dead-reconing module. It doesn't look like he's doing anything beyond declaring the sensor.

32    const char *GYRO_PORT="i2c-legoev35:i2c1";
...
85    ev3dev::i2c_sensor gyro(GYRO_PORT, {"mi-xg1300l"});

Later the code checks gyro->connected() before sending a command. Easy, right? Well, maybe not. It looks like bmegli may have modified the i2c_sensor class to get it working.

I certainly haven't been able to get it to work. Here's my code:

void gyroTest() {
    std::cout << "make instance of migyro" << std::endl;
    ev3dev::i2c_sensor mnfinity_gyro( "i2c-legoev35:i2c1", {"mi-xg1300l"} );
    if( !mnfinity_gyro.connected() ) {
        std::cout << "migyro.connected(): FALSE" << std::endl;
        return;
    }
    std::cout << "migyro.connected(): TRUE" << std::endl;
    return;
}

When I run the program, it always prints FALSE. This doesn't look like rocket surgery, so I must be passing an incorrect argument value. But I cannot find any other example code and I don't know if I need to get bmegli's patch. Someone who has used this sensor will surely be able to point me in the right direction.

As a sanity check, I booted the EV3 with the LEGO firmware and then ran a sample program from the Microinfinity web site that uses the LEGO Mindstorms block-programming environment. The program was able to display readings from the sensor, so I know the hardware is good and attached properly.

Here's my ev3dev sysinfo:

robot@ev3dev:~$ ev3dev-sysinfo -m
<!-- Copy everything between these lines -->
**System info (from `ev3dev-sysinfo`)**
```
Image file:         ev3dev-jessie-ev3-generic-2017-09-14
Kernel version:     4.4.87-22-ev3dev-ev3
Board:              LEGO MINDSTORMS EV3 Programmable Brick
Revision:           0006
Brickman:           0.8.1
ev3devKit:          0.4.3
```
<!-- Copy everything between these lines -->
robot@ev3dev:~$

ev3dev-lang-cpp ready for ev3dev-stretch ?

Hello,

Is everything is generated and modified for ev3dev-stretch ?

The first thing which is crashing is the power_supply... aïe.

Is it possible to make the update as soon as possible, please ?
I'm testing all my devices on stretch this weekend.

Making it work with ROS

Desperate for a tutorial a guide or help to make a ROS node running on a EV3 brick. I have with success run a Python node with the talker listener tutorial. And a Python node that prints numbers from a sensor, but can't combine them because one is on Python2 and the other on Python3. Therefore I now try to get a C++ node up and running, but I don't know how to install and setup this library and how to get a working environment.
How do I install it on the EV3 and how do I use it in a project? I work on a Linux Ubuntu machine, so that should make it easier.
I have figured out how to mount the EV3 file system on my Linux computer and have worked with docker. Now I just need to build a ROS node to run on the EV3 using this library to access the EV3's sensors and motors. Just wanna be sure how to include this library.

Mindstorms freezes while doing apt-get update

Hey,

I have the latest ev3dev installed on my mindstorms.

After I added these: deb http://httpredir.debian.org/debian unstable main contrib non-free deb http://security.debian.org/ unstable/updates main contrib non-free deb http://archive.ev3dev.org/debian unstable main (tutorial)

my mindstorms freezes at around 95-99% when I do sudo apt-get update or sudo apt-get install gcc-5/unstable.

Thank you for helping.

connect multiple motors to one EV3 port

Hello,
I would like to attach multiple medium EV3 motors to one port of the EV3. That is possible with the cables delivered with the NXT that were actually for using the lamps. Is there any way I can use the motor (of course not the rotation sensors, but just giving power on them for a certain time) with C++?
I tried declaring it as dc_motor, but always get the error that no device is connected.
Thank you for your help!

Compiling on windows leads to GLIBCXX error not found on ev3

I am recently trying to code my ev3 in c++, I installed ev3dev onto an sd card, I followed the instructions, but lo and behold, the ev3 complains it cannot find the Glibcxx 3.4.1 something so that it cannot run the program. I followed the step by step instructions here and made sure all packages were up to date on my windows bash, but nothing seems to work.

Multiple definitions of symbols when linking

I've found if I #include ev3dev stuff in separate compilation units then I get errors like this:

/usr/bin/ld: BoB/modules/robots/ev3/BoB/third_party/ev3dev-lang-cpp/libev3dev.a(ev3dev.cpp.o):(.rodata+0x370): multiple definition of `ev3dev::gyro_sensor::mode_gyro_ang'; BoB/modules/robots/ev3/libbob_robots__ev3.a(mindstorms_imu.cc.o):(.rodata._ZN6ev3dev11gyro_sensor13mode_gyro_angE[_ZN6ev3dev11gyro_sensor13mode_gyro_angE]+0x0): first defined here
/usr/bin/ld: BoB/modules/robots/ev3/BoB/third_party/ev3dev-lang-cpp/libev3dev.a(ev3dev.cpp.o):(.rodata+0x380): multiple definition of `ev3dev::gyro_sensor::mode_gyro_rate'; BoB/modules/robots/ev3/libbob_robots__ev3.a(mindstorms_imu.cc.o):(.rodata._ZN6ev3dev11gyro_sensor14mode_gyro_rateE[_ZN6ev3dev11gyro_sensor14mode_gyro_rateE]+0x0): first defined here
/usr/bin/ld: BoB/modules/robots/ev3/BoB/third_party/ev3dev-lang-cpp/libev3dev.a(ev3dev.cpp.o):(.rodata+0x3a0): multiple definition of `ev3dev::gyro_sensor::mode_gyro_g_a'; BoB/modules/robots/ev3/libbob_robots__ev3.a(mindstorms_imu.cc.o):(.rodata._ZN6ev3dev11gyro_sensor13mode_gyro_g_aE[_ZN6ev3dev11gyro_sensor13mode_gyro_g_aE]+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/mindstorms_imu.dir/build.make:103: mindstorms_imu] Error 1
make[1]: *** [CMakeFiles/Makefile2:209: CMakeFiles/mindstorms_imu.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

This can be worked around by passing --allow-multiple-definition to the linker, but this is a hack. I suspect the real problem lies in some symbols not properly being marked inline (or their definitions being put separately into a .cpp file).

I'm using gcc v11 on Arch Linux.

EV3 Motors not detected

Hi all,
I have problems with the EV3 motors - neither in the drive-test program nor in other programs they are detected with the .connected() command.
On the EV3, I am running brickman v0.8.1 with the 4.4.87-22-ev3dev-ev3 Kernel.
Thank you for your help!

Syntax errors when trying to cross compile

Hi,

I am new to ev3dev, but would really like to program my LEGO MINDSTORM EV3 using C++.

I have got the kernel image on an michroSD card and it works.
I have also compiled the ev3dev-lang-cpp on the EV3 it self. The sound-test demo program worked, but making the library was extremely slow!

When I try to cross compile using arm-linux-gnueabi on my 64-bit Ubuntu 14.04 Trusty, I get syntax errors during make:

export CXX=arm-linux-gnueabi-g++
export CC=arm-linux-gnueabi-gcc

mkdir -p build && cd build

--> CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ cmake ..
-- No build type selected, default to RelWithDebInfo
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/bin/arm-linux-gnueabi-gcc
-- Check for working C compiler: /usr/bin/arm-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabi-g++
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/martine/ev3dev-lang-cpp-master/build

--> make
Scanning dependencies of target ev3dev
[ 10%] Building CXX object CMakeFiles/ev3dev.dir/ev3dev.cpp.o
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp: In member function ‘void ev3dev::led::flash(unsigned int, unsigned int)’:
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp:859:7: error: ‘sleep_for’ is not a member of ‘std::this_thread’
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp: In static member function ‘static void ev3dev::sound::speak(const string&, bool)’:
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp:1098:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp: In static member function ‘static void ev3dev::sound::play(const string&, bool)’:
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp:1084:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp: In static member function ‘static void ev3dev::sound::beep(const string&, bool)’:
/home/martine/ev3dev-lang-cpp-master/ev3dev.cpp:1027:33: warning: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Wunused-result]
make[2]: *** [CMakeFiles/ev3dev.dir/ev3dev.cpp.o] Error 1
make[1]: *** [CMakeFiles/ev3dev.dir/all] Error 2
make: *** [all] Error 2

If anyone can help me, I will be so happy!

cannot connect to lego motors on ev3

I have cross compiled demo programs in demos directory on my Windows 10 machine and transferred the binary files to my ev3. Some of them work fine but not all of them.
For example button-test and sound-test work on my ev3.
But some of the demo programs don't work. For example it seems that it cannot connect to motors in demos/drive-test program. It fails in the very beginning when it checks for initialization below:
int main()
{
control c;
if( c.initialized() )

I have two lego motors connected to output B and C on my ev3.
I can see this :
/sys/class/tacho-motor/motor0
/sys/class/tacho-motor/motor1

and if I try something like the following commands, they all work!
echo reset > /sys/class/tacho-motor/motor0/command
echo run-forever > /sys/class/tacho-motor/motor0/command

Does anyone know what can be the problem? or where should I start to find the problem?

LED support for PiStorms V2

The current version of the library has no support for the PiStorms V2 leds on the panel.
I have tweaked ev3dev.h and ev3dev.cpp as follows to make it work (overwritten the BrickPi code as I don't have one, so my code is not portable).

#ifdef EV3DEV_PLATFORM_PISTORMS

    static led red_left;
    static led red_right;
    static led green_left;
    static led green_right;
    static led blue_left;
    static led blue_right;

    static std::vector<led*> left;
    static std::vector<led*> right;

    static std::vector<float> black;
    static std::vector<float> red;    
    static std::vector<float> green;
    static std::vector<float> blue;
#else
#ifdef EV3DEV_PLATFORM_PISTORMS

led led::red_left{"pistorms:BB:red:ev3dev"};
led led::red_right{"pistorms:BA:red:ev3dev"};
led led::green_left{"pistorms:BB:green:ev3dev"};
led led::green_right{"pistorms:BA:green:ev3dev"};
led led::blue_left{"pistorms:BB:blue:ev3dev"};
led led::blue_right{"pistorms:BA:blue:ev3dev"};

std::vector<led*> led::left{ &led::red_left, &led::green_left, &led::blue_left };
std::vector<led*> led::right{ &led::red_right, &led::green_right, &led::blue_right };

std::vector<float> led::black{ static_cast<float>(0), static_cast<float>(0) };
std::vector<float> led::red{ static_cast<float>(1), static_cast<float>(0) };
std::vector<float> led::green{ static_cast<float>(0), static_cast<float>(1) };
std::vector<float> led::blue{ static_cast<float>(1), static_cast<float>(1) };

//-----------------------------------------------------------------------------
void led::all_off() {

    red_left.off();
    red_right.off();
    green_left.off();
    green_right.off();
    blue_left.off();
    blue_right.off();

}

#else

Given that they are tri-state leds there is potential to introduce quite a range of colours. I might experiment with that when I've got the time and energy. (This came to mind by accident when I switched on red and blue on one of the leds and it glowed a lovely purple colour.)

Connecting two large EV3 motors

Hello!
I am searching for a solution to connect two large tacho-motors (EV3).
The following part is copied from the YDLidarCar library by Schwaneberg.
private:
CarControl();
virtual ~CarControl();
ev3dev::large_motor driveMotor;
ev3dev::medium_motor steeringMotor;

My attempts to add a second large motor failed. I tried it by calling them by their connected ports:

ev3dev::large_motor leftMotor(ev3dev::outA);
ev3dev::large_motor rightMotor(ev3dev::outD);

And I tried it by "auto-detecting":

ev3dev::large_motor leftMotor;
ev3dev::large_motor rightMotor;

I don't know any more possibilities.

Step 7, installing the librarys, doesnt work anymore.

I love the work you guys put in.
But I cant get GCC version 5 installed.
I added the three lines in the sources.list for aptly.
After which I update.

Hit:1 http://security.debian.org stretch/updates InRelease                                                                          
Ign:2 http://httpredir.debian.org/debian stretch InRelease                                                                          
Get:3 http://httpredir.debian.org/debian unstable InRelease [180 kB]                      
Ign:4 http://security.debian.org unstable/updates InRelease                               
Hit:5 http://archive.ev3dev.org/debian stretch InRelease                                  
Ign:6 http://archive.ev3dev.org/debian unstable InRelease                                 
Err:7 http://security.debian.org unstable/updates Release                                 
  404  Not Found
Hit:8 http://httpredir.debian.org/debian stretch Release                 
Err:9 http://archive.ev3dev.org/debian unstable Release                  
  404  Not Found
Get:10 http://httpredir.debian.org/debian unstable/contrib armel Packages [42.4 kB]                                                                                                                          
Get:11 http://httpredir.debian.org/debian unstable/non-free armel Packages [57.7 kB]                                                                                                                         
Get:12 http://httpredir.debian.org/debian unstable/main armel Packages [8,985 kB]                                                                                                                            
Reading package lists... 80% 

But it seems to be stuck at 80%. I let it run for hours. Nothing happens.
The SSH-Connection is also not broken (im using wired) as I could abort it easily.
It seems to me that something in some repository got bigger or changed or is not available (as the 404 above suggest) and thus it fails to read something or whatever.

Oh and im trying to fix this issue:
/lib/arm-linux-gnueabi/libm.so.6: version `GLIBC_2.27' not found
That obviously makes sense though because I cant even get past step 7.

Thanks in advance! :)

How to build my first test program?

I am new to this, and I have setup Brickstrap environment, it works fine, I would like to use your button-test.CPP program, I have copied it to my Brickstrap environment, what is the next step?

What happened to Carlson Minot?

The Carlson Minot website www.carlson-minot.com appears to be down. Does anyone know whether this is permanent or just a glitch?

Without the Carlson Minot toolchain, is there a description anywhere how to set up cross-compiling on OSX?

Cross-compile on PC

I'm trying to set up a friend's computer (a PC, while mine is a MAC) and I'm having an issue with the MentorGraphics toolchain: I can't compile with the -std=c++11 / -std=c++0x flag. Any ideas?

cross-compiling not working on Windows

The README says that cross-compiling works on Windows without a virtual machine using the MentorGraphics toolchain. But I am struggling to get it working on my Windows machine. I find a problem and solve it only encounter another build issue. Are there more details on how to get this working?

Gyro sensor implementation incorrect?

According to the documentation at http://www.ev3dev.org/docs/sensors/lego-ev3-gyro-sensor/, the GYRO-G&A mode should have the angle in value0, and rate in value1. However, the ev3dev.h implementation is:

// The number of degrees that the sensor has been rotated
// since it was put into this mode.
int angle() {
  set_mode(mode_gyro_ang);
  return value(0);
}

// The rate at which the sensor is rotating, in degrees/second.
int rate() {
  set_mode(mode_gyro_rate);
  return value(0);
}

(from https://github.com/ddemidov/ev3dev-lang-cpp/blob/master/ev3dev.h#L473)

Isn't this going to make it impossible to use the GYRO-G&A mode? Any attempt to call angle() and rate() will change the mode away from G&A mode. Aside from that, calling angle() and rate() repeatedly and alternating will cause the gyro to reset and recalibrate, correct?

It seems like a workaround is to use value(0) and value(1) directly... but it seems like it should be possible to use the more descriptive functions in all modes. At best (if working as intended), the API is misleading.

Step 7 gcc compiler doesnt exist

If I try to install the gcc-5 compiler I get this error:

robot@ev3dev:~$ sudo apt-get install gcc-5/unstable
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-5

I don't know how to fix it, can you please help me?

EV3 Sensors having blacokouts after start of the brick

Hello,
I am detecting a weird behaviour of some programs I wrote in C++ for the EV3: Usually every time when I run them directly after the start of the brick (or the first time), there is always one situation where either (most times) a line detection goes wrong. That may have to do with either the color or gyro sensor not sending values for some time, thus blocking the loop so the line doesn't get seen.Unfortunately, I couldn't yet write test programs right for this case, but noticed that in general, e.g. synchronisation loops seem to not have a very stable rate (loop rotations per second). I already had a look at ev3dev/ev3dev#324 but still wondering why this seem to only happen directly after the startup (btw at various different places in the program where the same function is used) and if there may be any way to get around this. I would be very thankful for any suggestions.
EDIT: Another interesting fact compared to #324 is that instead of lags of 6ms, there has to be (calculated with the distance the robot drives and the speed) a lag of ~50-70ms - of course there is some other calculations going on within the loop but with usually 300+ cycles per second (~3ms per cycle) that should not be the reason for the "lag".
EDIT2: Just made some tests with one of the programs that uses both the color and gyro sensor. Benlow is a graph with the duration of each loop cycle in ms on the vertical axis and a counter of loop cycles on the horizontal axis. Red and blue are just two tests with the same program.
bildschirmfoto von 2018-06-13 09-02-45

I am using brickman v0.8.1 with kernel version 4.4.87-22-ev3dev-ev3
Thank you in advance!

Segmentation Fault using globale variables

I thank you for the last fix about global variable, but it seems is not enough to fix my problems. I continue to get segmentation fault declaring global variable.

To reproduce my problem, you can edit the file ev3dev-lang-demo.cpp, replacing the full main() method by :

large_motor m{OUTPUT_A};
int main()
{
bool connected = m.connected();
if(connected){
printf("connected");
}else{
printf("not connected");
}
m.set_duty_cycle_sp(100);
m.run_forever();
m.set_duty_cycle_sp(0);
  main_menu();
  return 0;
}

The problem can be reproduce with all motors and sensors. It seems be the const like OUTPUT_A which are not yet initialized when we call them, but not sure.

Python bindings seem to be faster than CPP for `infrared_sensor.proximity()` or `touch_sensor.is_pressed()`

I was testing the speed difference between Python bindings (https://github.com/ev3dev/ev3dev-lang-python) and CPP bindings. The following python code:

import time
from ev3dev2.sensor.lego import TouchSensor, InfraredSensor

touch_sensor = TouchSensor()
infrared_sensor = InfraredSensor()

start = time.time()
end = time.time()
it = 0
while True:
    it += 1
    if touch_sensor.is_pressed:
        infrared_sensor.proximity
    if (it % 1000) == 0:
        end = time.time()
        elapsed_time = end - start
        print("%.3f Hz" % (1000 / elapsed_time))
        start = end

runs around 280 Hz when I do not press the touch sensor, and around 144 Hz when I touch it. On the other hand, the following CPP code:

#include <iostream>
#include <iomanip>
#include "ev3dev.h"
#include <chrono>

int main() {
    ev3dev::infrared_sensor infrared_sensor(ev3dev::INPUT_4);
    ev3dev::touch_sensor touch_sensor(ev3dev::INPUT_1);
    int it = 0;
    auto start = std::chrono::steady_clock::now();
    auto end = std::chrono::steady_clock::now();
    while (true) {
        it++;
        if (touch_sensor.is_pressed()) {
            infrared_sensor.proximity();
        }
        if (it % 1000 == 0) {
            end = std::chrono::steady_clock::now();
            std::chrono::duration<double> time_elapsed = end - start;
            float frequency = 1000 / time_elapsed.count();
            std::cout << std::setprecision(3) << frequency << " Hz" << std::endl;
            start = end;
        }
    }
}

runs around 870 Hz when I do not press the touch sensor, and around 20-30 Hz when I touch it. I would expect the CPP code to run faster compared to python, at least around the speed. Though, I am no CPP expert. Is there something I am missing here? I compiled the code in a docker container and below is the makefile:

TARGET = demo

$(TARGET): main.cpp ev3dev.o
        arm-linux-gnueabi-g++ -pthread -std=c++11 $^ -o $(TARGET)

ev3dev.o: ev3dev.cpp ev3dev.h
        arm-linux-gnueabi-g++ -std=c++11 -c -o $@ $<

clean:
        rm $(TARGET)

Thanks in advance.

running cmake on Windows

CMake isn't using my cross-compiler toolchain. I've successfully installed the code sourcery toolchain, built a simple hello world app, and run it on my brick. That works just fine. The trouble is that CMake uses my host's g++ compiler instead of the toolchain. I'm familiar with linux and cross-compilers, but I'm a total CMake noob. So I suspect CMake is where I'm going wrong.

I've added the following lines into CMakeLists.txt:

set(CMAKE_C_COMPILER    "/cygdrive/c/Users/me/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc.exe")
set(CMAKE_CXX_COMPILER  "/cygdrive/c/Users/me/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-g++.exe")

Here's the terminal output:

$ g++ --version
g++ (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ /cygdrive/c/Users/me/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-gcc.exe --version
arm-none-linux-gnueabi-gcc.exe (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ mkdir build
$ cd build
$ cmake ../ -DEV3DEV_PLATFORM=EV3
-- No build type selected, default to RelWithDebInfo
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
CMake Warning at /usr/share/cmake-3.6.2/Modules/Platform/CYGWIN.cmake:15 (message):
  CMake no longer defines WIN32 on Cygwin!

  (1) If you are just trying to build this project, ignore this warning or
  quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or in
  the CMake cache.  If later configuration or build errors occur then this
  project may have been written under the assumption that Cygwin is WIN32.
  In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead.

  (2) If you are developing this project, add the line

    set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required

  at the top of your top-level CMakeLists.txt file or set the minimum
  required version of CMake to 2.8.4 or higher.  Then teach your project to
  build on Cygwin without WIN32.
Call Stack (most recent call first):
  /usr/share/cmake-3.6.2/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
  CMakeLists.txt:7 (project)


-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/Users/me/Documents/AppProjects/ev3dev-lang-cpp/build

$

CMake is clearly using the cygwin host g++ compiler even though I've attempted to configure it to use the toolchain. Where am I going wrong?

Cannot compile library on brick

When typing make as per the ev3 brick instructions I receive the error:

c++: internal compiler error: Killed (program cc1plus)

This happens no matter how many jobs I assign: -j1 does not even work.

Is there a reason for this? I considered the idea that my SD card is too small, but this is more of a processor problem, right?

Thank you

Configuring / Accessing sensors on PiStorms query.

Beginner's query here. I am running EV3DEV on a PiStorms V2
I have made some edits to ev3dev.h to map PiStorms ports like so
#ifdef EV3DEV_PLATFORM_PISTORMS
constexpr char INPUT_1[] = "pistorms:BA:S1"; //!< Sensor port 1
constexpr char INPUT_2[] = "pistorms:BA:S2"; //!< Sensor port 2
constexpr char INPUT_3[] = "pistorms:BB:S1"; //!< Sensor port 3
constexpr char INPUT_4[] = "pistorms:BB:S2"; //!< Sensor port 4

constexpr char OUTPUT_A[] = "pistorms:BAM1"; //!< Motor port A
constexpr char OUTPUT_B[] = "pistorms:BAM2"; //!< Motor port B
constexpr char OUTPUT_C[] = "pistorms:BBM1"; //!< Motor port C
constexpr char OUTPUT_D[] = "pistorms:BBM2"; //!< Motor port D
#else
...

With a motor attached to BAM1, the code below compiles (on the Pi for now) and executes fine. It displays the hello string in the console and runs the motor for a short while (5 seconds I assume).

int main()
{
cout << "Hello from pistorms!\n";
motor mymotor(OUTPUT_A);
mymotor.set_speed_sp(900);
mymotor.set_time_sp(5000).run_timed();
return 0;
}

I'm now trying to connect and access some sensors. I understand that the PiStorms unit is not auto-sensing and I need to manually set the mode and possibly the sensor device that is attached. I can't figure out how to do this programmatically. I have attempted things like
lego_port myport(INPUT_1);
or
touch_sensor mytouch(INPUT_1);

but they invariably return
terminate called after throwing an instance of 'std::system_error'
what(): no device connected: Function not implemented
when trying to retrieve value or mode.

(reading the sensor works OK via the console through the lego-port 'class'.)

Looking for some guidance please on how to configure and access the sensor ports on my PiStorms.

Would you be interested in working UTs which could be run on host system?

I did a bit of refactoring here, and made UTs to run in host system. I injected mock system via a base class (which uses virtual calls) instead of macros and FAKE_SYS file generation: https://github.com/biocomp/ev3dev-lang-cpp2/blob/master/tests/api_tests.cpp.

I messed with cmake files and headers quite a lot, I guess I can simplify the change if there's an interest.

Also, there's a bug in the cache which I've found with the tests.

Access file as quickly as possible

Hi,

I'm trying to optimise the access to the file value0 for angle sensors, or IR sensors.
Because my motion system need these data every 5ms.

ifstream is currently used, I already managed some little change to decrease access time, but it's not enough (I opened the file once at the beginning, and during the loop, I just read).

Do you know how to be faster to retrieve the value (int) inside the file ?
Maybe using POSIX like described here
https://stackoverflow.com/questions/17925051/fast-textfile-reading-in-c
What do you think ?

You seem to use a cache, but I don't understand, Are you sure that the cache is really used using this current code in ev3dev.cpp ?

// A global cache of files.
std::ifstream& ifstream_cache(const std::string &path) {
  static lru_cache<std::string, std::ifstream> cache(FSTREAM_CACHE_SIZE);
  static std::mutex mx;

  std::lock_guard<std::mutex> lock(mx);
  return cache[path];
}

BR,
Cho.

BrickPI 3 doesn't find motors on Jessie

Hello

I'm using the Jessie branch because i'm using the EV3DEV Jessie. My system runs on a Raspberry Pi3 with a BrickPi 3. I can succesfully build the demos but I can't connect with my motors in any script.

I did some research and I found that in de EV3DEV.h file the addresses for the Brickpi are wrong. They are still using the old addresses. (see http://www.ev3dev.org/docs/platform-comparison/)

Then I tried changing them to "spi0.1:Mx" but I still can't connect to them after a rebuild.

Build Help

I know nothing about CMake, so I am having difficulty building my code. For example, the main function is robotMain.cpp, and all files are located in a folder called src below ev3dev-lang-cpp. Movement.cpp includes ev3dev.h. Here is the CMake file:

add_library(libRobot output.cpp AI.cpp premapRead.cpp input.cpp movement.cpp)
target_link_libraries(libRobot ev3dev)
add_executable(robotMain robotMain.cpp)
target_link_libraries(robotMain libRobot)

When I call make in the build folder, however, errors like these occur:

[ 90%] Building CXX object src/CMakeFiles/robotMain.dir/robotMain.cpp.o
In file included from /home/jasper/ev3dev-lang-cpp/src/movement.h:4:0,
                 from /home/jasper/ev3dev-lang-cpp/src/API.h:25,
                 from /home/jasper/ev3dev-lang-cpp/src/robotMain.cpp:3:
/home/jasper/ev3dev-lang-cpp/ev3dev.h:665:21: error: ISO C++ forbids declaration of ‘address_type’ with no type [-fpermissive]
   motor(address_type);
                     ^
/home/jasper/ev3dev-lang-cpp/ev3dev.h:666:21: error: expected ‘)’ before ‘,’ token
   motor(address_type, const motor_type&);
                     ^
/home/jasper/ev3dev-lang-cpp/ev3dev.h:668:25: error: static data member ‘ev3dev::<anonymous class>::motor_large’ in unnamed class [-fpermissive]
   static constexpr char motor_large[]  = "lego-ev3-l-motor";
                         ^
/home/jasper/ev3dev-lang-cpp/ev3dev.h:660:13: note: unnamed class defined here
 class motor : protected device
             ^
/home/jasper/ev3dev-lang-cpp/ev3dev.h:669:25: error: static data member ‘ev3dev::<anonymous class>::motor_medium’ in unnamed class [-fpermissive]
   static constexpr char motor_medium[] = "lego-ev3-m-motor";
                         ^
/home/jasper/ev3dev-lang-cpp/ev3dev.h:677:25: error: static data member ‘ev3dev::<anonymous class>::command_run_forever’ in unnamed class [-fpermissive]
   static constexpr char command_run_forever[] = "run-forever";
                         ^

(These errors go on for many lines, but this gives the basic idea.)

Any help would be greatly appreciated!

Linking error with libev3dev.a

Hi,

First of all thank you for this great libary. I am really looking forward to give it a try.

I have set up the official ev3dev docker container for cross compilation and I have been able to cross compile simple C/C++ programs as well as your library.

However, there seems to be something wrong with the cross compilation of your library. Inspite of being able to include the header file as well as pass it to the linker, there are linking errors when calling methods of the motor class. I get the following error:

libev3dev.a: error adding symbols: File format not recognized

This indicates that the library has not been compiled for the same architecture as my program. I have followed the instructions in your README file to compile the static library. I am using the arm-linux-gnueabi-g++ compiler in order to compile my program. Furthermore, I have set the following environment variables in order to make sure that CMake uses the correct compiler

ev3dev@spt:~/development/brickCollector$ echo $CC
arm-linux-gnueabi-gcc
ev3dev@spt:~/development/brickCollector$ echo $CXX
arm-linux-gnueabi-g++

My Makefile can be seen below:

PROGNAME=brickCollector
CC = arm-linux-gnueabi-g++
#CC = g++
CFLAGS = -g -Wall -std=c++11 -c -I /home/ev3dev/development/ev3dev-lang-cpp
LDFLAGS = -Wall -o
LIBS = -L/home/ev3dev/development/ev3dev-lang-cpp/build -lev3dev

all: $(PROGNAME)

${PROGNAME}: brickCollector.o
    $(CC) $(LDFLAGS) $(PROGNAME) brickCollector.o $(LIBS)

brickCollector.o: brickCollector.cpp brickCollector.h
    $(CC) $(CFLAGS) brickCollector.cpp

install:
    cp $(PROGNAME) /home/ev3dev/development/ev3/$(PROGNAME)

clean:
    rm -f $(PROGNAME) *.o *.out

The function causing the issue is shown below.

void motor_action(motor &dev)
{
    cout << "Address: " << dev.address() << endl;
}

I would be most graceful if you could tell me the compiler being used for compiling your library.

Yours sincerely,

Lukas

Problem while compiling

I am having a proving while compiling, aparently the compiler cannot find the ev3dev.h file eventhoug I have clone this repository as you can see. What am I doing wrong?

eduponz@ubuntu:~/forklift_ws$ ls
ev3dev-lang-cpp  forklift.cpp
eduponz@ubuntu:~/forklift_ws$ g++ -std=c++11 forklift.cpp -o forklift
forklift.cpp:8:20: fatal error: ev3dev.h: No such file or directory
compilation terminated.
eduponz@ubuntu:~/forklift_ws$ 

Dual licensing

It was requested in a private email to switch from GPL to LGPL or a dual licensing scheme. I don't mind in principle (although I would prefer MIT/BSD type license), but the repo has a lot of contributions by other developers, namely @fdetro and @WasabiFan.

This issue is to discuss the proposed license change.

PThread functions not working

When I try to compile a program that uses thread (for example, drive-test demo), it gives the following error:
undefined reference to pthread_create
for each time the function was called.

Thought it has no problem in the statement: #include <thread>
Also, any program that doesn't use thread is working fine.

I'm compiling statically using g++-arm-linux-gnueabi compiler on Ubuntu with the following command:
arm-linux-gnueabi-g++ -o main -static main.cpp ev3dev.cpp

Problem with pthread_xxx code (version GLIBCXX_3.4.21 not found)

While playing with pthread_create() and pthread_join() in a C++ source code, I get this strange error :

robot@ev3dev:~/snir2$ ./test_threads 
terminate called after throwing an instance of '__gnu_cxx::__concurrence_broadcast_error'
  what():  __gnu_cxx::__concurrence_broadcast_error
Abandon

After googling it, I have read some solution from issue #27
I installed docker image and compiled the same source code with :
arm-linux-gnueabi-g++ -o test_threads -std=c++11 -static test_threads.cpp ev3dev.cpp -lpthread

I quess these error is strongly linked to the static compilation.
From the docker image, I compiled with :
arm-linux-gnueabi-g++ -o test_threads -std=c++11 test_threads.cpp ev3dev.cpp -lpthread

Now, I get an error dealing with the libstdc++ version :

./test_threads: /usr/lib/arm-linux-gnueabi/libstdc++.so.6: version GLIBCXX_3.4.21 not found (required by ./test_threads)

I have no clue how to fix all these errors...

ev3dev version installed on the robot is :

robot@ev3dev:~/snir2$ uname -a
Linux ev3dev 4.4.87-22-ev3dev-ev3 #1 PREEMPT Sat Sep 9 14:45:55 CDT 2017 armv5tejl GNU/Linux

Problem to run a simple motor program

Hello!

I am trying to code a simple C++ program for large motors but it seems ev3 can't connect it. I am trying this simple code:

#include<bits/stdc++.h>
#include "ev3dev.h"

using namespace std;
namespace ev3 = ev3dev;

void precondition(bool cond, const std::string &msg) {
    if (!cond) throw std::runtime_error(msg);
}

int main(){

        ev3::large_motor leftMotor(ev3::OUTPUT_B);
        ev3::large_motor rightMotor(ev3::OUTPUT_C);

        precondition(leftMotor.connected(), "motor no outB nao conectado");
        precondition(rightMotor.connected(), "motor no outC nao conectado");

        while(!ev3::button::back.pressed()){
                rightMotor.run_forever();
                leftMotor.run_forever();
        }

        return 0;
}

The error is:

terminate called after throwing an instance of 'std::runtime_error'
  what():  motor no outB nao conectado
Aborted

But I checked the ports on the EV3 itself and it was okay.

Fortunally, I can compile and run simple programs using sensors only.

I'd be very grateful if anyone can help me!

CMakeLists.txt forces C++11, breaking C++14 projects wanting to include it

Currently we have this line in CMakeLists.txt:

target_compile_options(ev3dev PUBLIC -std=c++0x)

The problem is that by making this option public, any project which includes it (with add_subdirectory()) will also be set to use C++11, which will break things if the user also wants to use C++14 code.

Changing the PUBLIC to PRIVATE fixes things for me. Another option would be to use the newer ${CMAKE_CXX_STANDARD} variable if the user's version of cmake supports it: https://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake

Position regulation - problem with PID constants

I tried to set PID constants on position regulator by this command set_position_p(int v) and I got this error:

Unhandled exception: Operation not supported
Terminating

I normaly use the position regulator by these commands

motor.set_speed_regulation_enabled("on");
motor.set_speed_sp(speed);
motor.set_position_sp(position);
motor.run_to_rel_pos();

and this is working, but I couldn't set the PID constants.

Do I something wrong or is it problem somewhere else?

Thanks you for any advice or help.

Docker container

I have installed this in my docker container. However, when I run arm-linux-gnueabi-g++ -o main main.cpp (in which there is #include <ev3dev.h>), it doesn't work. I'm really new to cross-compilation and linux, so consider this question as a beginner question.

Support for bluetooth connections?

Is it possible to establish tcp socket-like connection on bluetooth between the ev3 brick and my computer? I've found some python programs that can establish a bluetooth rfcomm connection on the ev3 (connecting spike prime with ev3 brick), but I don't see any way of doing this with c++.
Can anyone point me to a resource about this? thanks.

Error while compiling (make)

After I downloaded the latest stable version of ev3dev (jessie) from here and burned it on my SD-Card, I connected to my EV3 via SSH.

I cloned this repo an cd into it.
Then I followed the steps from here:

robot@ev3dev:~$ git clone https://github.com/ddemidov/ev3dev-lang-cpp
Cloning into 'ev3dev-lang-cpp'...
remote: Enumerating objects: 756, done.
remote: Total 756 (delta 0), reused 0 (delta 0), pack-reused 756
Receiving objects: 100% (756/756), 386.96 KiB | 155.00 KiB/s, done.
Resolving deltas: 100% (489/489), done.
Checking connectivity... done.
robot@ev3dev:~$ cd ev3dev-lang-cpp
robot@ev3dev:~/ev3dev-lang-cpp$ mkdir build
robot@ev3dev:~/ev3dev-lang-cpp$ cd build
robot@ev3dev:~/ev3dev-lang-cpp/build$ cmake .. -DEV3DEV_PLATFORM=EV3
-- No build type selected, default to RelWithDebInfo
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/robot/ev3dev-lang-cpp/build
robot@ev3dev:~/ev3dev-lang-cpp/build$ make
Scanning dependencies of target ev3dev
[ 10%] Building CXX object CMakeFiles/ev3dev.dir/ev3dev.cpp.o
Linking CXX static library libev3dev.a
[ 10%] Built target ev3dev
Scanning dependencies of target api_tests
[ 20%] Building CXX object tests/CMakeFiles/api_tests.dir/api_tests.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
tests/CMakeFiles/api_tests.dir/build.make:54: recipe for target 'tests/CMakeFiles/api_tests.dir/api_tests.cpp.o' failed
make[2]: *** [tests/CMakeFiles/api_tests.dir/api_tests.cpp.o] Error 4
CMakeFiles/Makefile2:110: recipe for target 'tests/CMakeFiles/api_tests.dir/all' failed
make[1]: *** [tests/CMakeFiles/api_tests.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

What does this error mean? Can you skip the target api_tests?

Cross Compiling on Windows command not working

Hi guys, I followed all the steps on the cross-compiling tutorial for the linux subsystem, except instead of installing gcc5/unstable I installed gcc6/stable on the ev3. Anyhow, on the subsystem, I tried running:

"arm-linux-gnueabi-g++ test.c -lev3dev-c -o test",

and it said it couldn't recognize the "ev3.h" file I included like this:

test.c:1:10: fatal error: ev3.h: No such file or directory
#include "ev3.h"
^~~~~~~

Is there anything I'm missing here?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.