Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    how to include arduino library in socketServer.cpp ?

    Scheduled Pinned Locked Moved
    Firmware developers
    2
    6
    1.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • eBerlinundefined
      eBerlin
      last edited by

      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 to HTTPClient::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 to HTTPClient::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

      JoergS5undefined 2 Replies Last reply Reply Quote 0
      • JoergS5undefined
        JoergS5 @eBerlin
        last edited by JoergS5

        @eBerlin

        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.

        1 Reply Last reply Reply Quote 0
        • JoergS5undefined
          JoergS5 @eBerlin
          last edited by JoergS5

          @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.

          1 Reply Last reply Reply Quote 0
          • eBerlinundefined
            eBerlin
            last edited by

            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

            JoergS5undefined 1 Reply Last reply Reply Quote 0
            • JoergS5undefined
              JoergS5 @eBerlin
              last edited by

              @eberlin I thought the links are of no use. I try to restore them.

              1 Reply Last reply Reply Quote 0
              • eBerlinundefined
                eBerlin
                last edited by eBerlin

                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:

                0_1537249502820_Bildschirmfoto 2018-09-18 um 07.44.42.png

                as you can see, i used here the ESP8266RestClient- library, because i can't found the ESP8266HTTPClient - lib under Eclipse -> Preferences -> Arduino -> Libraries.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA