3

I'm following this question and am curious how I go about actually importing the following the necessary dependencies. I see this line:

#include "ev3sources/lms2012/c_com/source/c_com.h"

and have downloaded the entire lms2012 directory. Importing that into visual studio is proving more difficult than it would seem. I can add that single dependency by following the directions posted here by adding just the c_com header and executable, but then I'm missing the dependencies upon which it rests. How can I add this entire directory as a dependency?

Thanks!

[Update]

Thanks David for your recommendation to add just the dependencies I need. Which would those be for the following? Adding c_com.h then prompts me to add lms2012.h and then dirent.hand on and on. I just want the isolate the functionality below.

#include <unistd.h>
#include <fcntl.h>
#include "ev3sources/lms2012/c_com/source/c_com.h"

int main()
{

    // start motor on port A at speed 20
    unsigned const char start_motor[] {12, 0, 0, 0,
        DIRECT_COMMAND_NO_REPLY,
        0, 0,
        opOUTPUT_POWER, LC0(0), LC0(0x01), LC0(20),
        opOUTPUT_START, LC0(0), LC0(0x01)};

    // send above command to EV3 via Bluetooth
    int bt = open("/dev/tty.EV3-SerialPort", O_WRONLY);
    write(bt, start_motor, 14);
    close(bt);
}

1 Answer 1

3

lms2012 is the entire virtual machine that runs on the EV3. It is meant to be compiled using Eclipse on Linux. There is really no use trying to include the whole thing and build it in Visual Studio on Windows because it doesn't have the required Linux libraries.

If you are trying to develop your own remote control program, then just copy the relevant header files from lms2012 and include them in your source code. The data types and #defines from the header files are really all you need.

3
  • I've updated my question to include my problems on attempting to do so. I know you've already answered the question but any additional help would be greatly appreciated.
    – Karoh
    Commented Dec 23, 2015 at 19:09
  • You will need c_com.h, lms2012.h, lmstypes.h and bytecodes.h at a minimum. If you need the other header files (like dirent.h) that aren't included in the lms2012 download, you can get them from the CodeSourcery toolchain (go.mentor.com/2ig4q). Or you can comment out the parts you don't need if you don't want to track down the header files. Commented Dec 25, 2015 at 21:35
  • Also, here are some instructions on how to setup Eclipse for the whole lms2012. You might be able to adapt the information to Visual Studio. github.com/mindboards/ev3sources/wiki/Eclipse-import Commented Dec 25, 2015 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.