Using Dobot API with MinGW


#1

Hello everybody

I need to control the Dobot magician in my university lab usign C++ code, compiling it with gcc on Linux and with MinGW on Windows. Could anyone please explain me exactly how to include and link Dobot libraries.

I tried the following very simple test.cpp

#include <iostream>
#include <string>
#include "DobotDll.h"

int main ()
{
  std::string portname = "";
  int state = ConnectDobot(portname.c_str(), 115200);
  
  std::cout<<"Dobot state = "<<state<<std::endl;
  
  return 0;
}

and I tried to compile it with

i686-w64-mingw32-g++ test.cpp -I. -L. -lDobotDll

but I get the following error

/tmp/ccrCn2gQ.o:test.cpp:(.text+0x98): undefined reference to “ConnectDobot”
collect2: error: ld returned 1 exit status