Answers.Body: <p>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.</p>
  
  <p>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 <code>#define</code>s from the header files are really all you need.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-23T19:09:31.873Z
Answers.Text: 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.
Answers.UserDisplayName: Karoh
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-25T21:35:13.637Z
Answers.Text: 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 (http://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.
Answers.UserDisplayName: David Lechner
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-25T21:35:57.797Z
Answers.Text: 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. https://github.com/mindboards/ev3sources/wiki/Eclipse-import
Answers.UserDisplayName: David Lechner
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-23T17:03:32.237Z
Answers.LastActivityDate: 2015-12-23T17:03:32.237Z
Answers.UserDisplayName: David Lechner
Body: <p>I'm following <a href="https://stackoverflow.com/questions/24253509/using-c-to-get-data-from-a-lego-ev3-sensor">this</a> question and am curious how I go about actually importing the following the necessary dependencies. I see this line:</p>
  
  <pre><code>#include "ev3sources/lms2012/c_com/source/c_com.h"
  </code></pre>
  
  <p>and have downloaded the entire <code>lms2012</code> 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 <a href="https://stackoverflow.com/questions/20058864/how-to-include-libraries-in-visual-studio-2012">here</a> by adding just the <code>c_com</code> header and executable, but then I'm missing the dependencies upon which it rests. How can I add this entire directory as a dependency?</p>
  
  <p>Thanks!</p>
  
  <p><strong>[Update]</strong></p>
  
  <p>Thanks David for your recommendation to add just the dependencies I need. Which would those be for the following? Adding <code>c_com.h</code> then prompts me to add <code>lms2012.h</code> and then <code>dirent.h</code>and on and on. I just want the isolate the functionality below. </p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;fcntl.h&gt;
  #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);
  }
  </code></pre>
  
Tags: <ev3>
Title: How do I add the lms2012 library as a dependency within Visual Studio
UserDisplayName: Karoh
ThreadText: # How do I add the lms2012 library as a dependency within Visual Studio
  
  (Asked by: username_0 on 2015-12-23)
  
  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 
  #include 
  #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);
  }
  
  **Tags:** ev3
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-23. Score: 3 | Accepted answer
  
  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 `#define`s from the header files are really all you need.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_1**: 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 (http://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.  
  > **username_1**: 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. https://github.com/mindboards/ev3sources/wiki/Eclipse-import  
  
  ---
  
  