Announcement

Collapse
No announcement yet.

Difficulty setting up c++ programming enviroment with api2

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Difficulty setting up c++ programming enviroment with api2

    Hi there,

    Im a bit of a novice when it comes to using visual studio and libraries. When using api2 I'm getting syntax errors in the api2 header files, I'm sure this cannot be correct and I must have my project set up incorrectly. I tried following the tutorials from Robotino Wiki but I was having issues with CMake so I just linked the api2 lib in visual studio as normal.

    If someone could shed some light on how they have their project set up in visual studio that would be really helpful, I'm using visual studio 2017, the latest version of api2 and windows 10.

    Thankyou very much

    -Jay

  • #2
    Hi,
    https://doc.openrobotino.org/downloa...4_20190311.zip
    This is API2 for VS2017 64bit.
    Unzip it somewhere. In VS you have to set include path to the include dir and library path to the lib dir.
    Then you can link your program. At runtime your program needs the api2 dlls. So copy the dlls to your program working directory.
    Regards
    Christian

    Comment


    • #3
      Hey verbeek,

      Thank you so much for getting back to me. I was hoping this would be the fix I was looking for as I was missing the .dll files in my first attempt. However, after creating a new project, linking everything as you said and including the .dll files Im still getting syntax errors from the include files.

      Here is small sample of the errors I'm getting as there are hundereds of them:

      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(50): error C2143: syntax error: missing ')' before '('
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(50): error C2079: 'visibility' uses undefined class 'rec::robotino::api2::__attribute__'
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(50): error C2059: syntax error: ')'
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(53): error C2440: 'initializing': cannot convert from 'const char [8]' to 'int'
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(53): note: There is no context in which this conversion is possible
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(53): error C2146: syntax error: missing ';' before identifier 'ComId'
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(54): error C2255: 'friend': not allowed outside of a class definition
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(54): error C2062: type 'rec::robotino::api2::WorkerThread' unexpected
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(55): error C2059: syntax error: 'public'
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(62): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      1>c:\users\jay howarth\documents\install\include\rec\robotino\api 2\comid.h(62): error C2365: 'rec::robotino::api2::ComId': redefinition; previous definition was 'data variable'


      I'm not entirely sure where to go from this point, but I will keep snooping around the forums for any advice. If you can shed any light on this it would be amazing.

      Thank you,

      Jay

      Comment


      • #4
        There is a space in your path
        \rec\robotino\api 2\
        where does this come from?

        Comment


        • #5
          Not entirely sure, after recompiling the space has gone. Its not in any of the include paths, just printed that way in the error. Just to make sure I created a new project and linked it again.
          Still getting the same set of synax errors from the include files, Im simply building a .cpp with:

          #include "rec/robotino/api2/all.h"

          int main() {

          }


          Feel like I'm exhausting all my resources here, might have to look into alternative ways of approaching this. I have access to a linux machine running Ubuntu 18.04.2, might see if I have more luck using that instead.

          Once again, thankyou very much for your help and support. Any and all advice is appreciated

          Comment

          Working...
          X