how to include arduino library in socketServer.cpp ?
-
i'am new to c/c++ , but i want to use the ESPHTTPClient library from arduino.
my goal is, to send a post request with the wifi modul of the duet board.this is the example code i want to use in the serverSocket.cpp:
HTTPClient http; http.begin("myServer/test"); http.addHeader("Content-Type", "application/x-www-form-urlencoded"); http.POST("message=test"); http.writeToStream(&Serial); http.end();
but i'am getting always this error:
C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference to
HTTPClient::HTTPClient()' C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference to
HTTPClient::begin(String)'
C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference toHTTPClient::addHeader(String const&, String const&, bool, bool)' C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference to
HTTPClient::POST(String)'
C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference toHTTPClient::writeToStream(Stream*)' C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference to
HTTPClient::end()'
C:\workspace\wifisocketserver\DuetWiFiSocketServer\Release/../src/SocketServer.cpp:1053: undefined reference to `HTTPClient::~HTTPClient()'i tried a couple of tutorials , how to include libraries, but no one removed the error or shows a solution
-
Here are the links:
Maybe this helps also:
https://arduino-esp8266.readthedocs.io/en/latest/eclipse/eclipse.html
It doen't containt HttpClient, but explains how to include Arduino into the Eclipse C++.
The ESPHTTPClient github has a Wiki, maybe this helps you:
https://github.com/esp8266/esp8266-wiki/wiki
and on the right Toolchain or Build.
There is an ESP Forum at
https://www.esp8266.com/index.php
and ESP Arduino:
https://www.esp8266.com/viewforum.php?f=25
Most discussion is about using Arduino IDE, but I saw some threads about Eclipse also. -
@eberlin said in how to include arduino library in socketServer.cpp ?:
ESPHTTPClient
I didn't find much information about this library. It seems to depend on Espressif SDK, this could become complicated...
Another option is:
DuetWifiSocketServer depends on two other projects which you should import first: CoreESP8266 and LwipESP8266. I am sure you find sample code in the SocketServer or Duet code how to install a network connection and how to use it. -
you find more information with the name ESP8266HTTPClient.
its in the arduino libraries.i have already imported the two other project, and i think you are right, maybe i found code that gives the same functionality, but i generall want to know how to include and use ardunio libraries in the DuetSocketServer project.
i wanted to try your links in the post above, but now its deleted... ca you please post them again ? ;D
-
@eberlin I thought the links are of no use. I try to restore them.
-
ok thanks,
i followed this tut (http://richmondsystems.net/2017/06/18/using-arduino-library-in-eclipse/ )
step by step but at the and i'am getting a bunch of errors:as you can see, i used here the ESP8266RestClient- library, because i can't found the ESP8266HTTPClient - lib under Eclipse -> Preferences -> Arduino -> Libraries.