C:/Work/Actisense/Esp32_http/build/cpp_utils\libcpp_utils.a(WebSocket.o):(.rodata._ZTI23WebSocketInputStreambuf[typeinfo for WebSocketInputStreambuf]+0x8): undefined reference to `typeinfo for std::basic_streambuf<char, std::char_traits<char> >'
collect2.exe: error: ld returned 1 exit status
make: *** [C:/Work/LibDev/esp32/esp-idf/make/project.mk:388: /c/Work/Actisense/Esp32_http/build/app-template.elf] Error 1
I am getting this error when I used HttpServer. I start happening recently. I was compiling before.
#include "HttpServer.h"
#include "HttpRequest.h"
#include "HttpResponse.h"
#include <Task.h>
#include <WiFi.h>
#include <WiFiEventHandler.h>
#include <tcpip_adapter.h>
#include "esp_log.h"
#include "sdkconfig.h"
#include <esp_wifi.h>
extern "C" {
void app_main(void);
}
static WiFi *wifi;
static void helloWorldHandler(HttpRequest* pRequest, HttpResponse* pResponse)
{
printf("helloWorldHandler gets called\n");
pResponse->setStatus(HttpResponse::HTTP_STATUS_OK, "OK");
pResponse->addHeader(HttpRequest::HTTP_HEADER_CONTENT_TYPE, "text/plain");
pResponse->sendData("Hello back");
pResponse->close();
}
class HttpTask: public Task {
void run(void *data) {
ESP_LOGD("http", "Testing http ...");
HttpServer* pHttpServer = new HttpServer();
pHttpServer->addPathHandler(
HttpRequest::HTTP_METHOD_GET,
"/helloWorld",
helloWorldHandler);
pHttpServer->start(80);
return;
}
};
static HttpTask *http_task;
class MyWiFiEventHandler: public WiFiEventHandler {
public:
esp_err_t staGotIp(system_event_sta_got_ip_t event_sta_got_ip)
{
printf("staGotIp\n");
http_task = new HttpTask();
http_task->setStackSize(12000);
http_task->start();
return ESP_OK;
}
esp_err_t apStart()
{
printf("apStart\n");
/*
esp_err_t err = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA, "mytest");
printf("tcpip_adapter_set_hostname err=%d\n", err);
*/
return ESP_OK;
}
};
C++ utils linker error
Re: C++ utils linker error
Hi,
Can some one answer this asap. I am stuck with this error.
Can some one answer this asap. I am stuck with this error.
Re: C++ utils linker error
Can anyone help me with this linker error?
Re: C++ utils linker error
You are missing some reference to this file:
https://github.com/nkolban/esp32-snippe ... cket.h#L21
https://github.com/nkolban/esp32-snippe ... cket.h#L21
Re: C++ utils linker error
Hi,
I do not know what you mean. I am compiling WebSocket.cpp so there is WebSocket.o file generated.
This is linker error.
Thanks,
Naeem
I do not know what you mean. I am compiling WebSocket.cpp so there is WebSocket.o file generated.
This is linker error.
Thanks,
Naeem
Re: C++ utils linker error
No linker error If I comment out the code HttpServerTask usage. Any idea how to fix it.
void HttpServer::start(uint16_t portNumber, bool useSSL) {
// Design:
// The start of the HTTP server should be as fast as possible.
ESP_LOGD(LOG_TAG, ">> start: port: %d, useSSL: %d", portNumber, useSSL);
// Take the semaphore that says that we are now running. If we are already running, then end here as
// there is nothing further to do.
if (m_semaphoreServerStarted.take(100, "start") == false) {
ESP_LOGD(LOG_TAG, "<< start: Already running");
return;
}
m_useSSL = useSSL;
m_portNumber = portNumber;
// comment out below two lines to avoid linker error.
//HttpServerTask* pHttpServerTask = new HttpServerTask("HttpServerTask");
//pHttpServerTask->start(this);
ESP_LOGD(LOG_TAG, "<< start");
} // start
void HttpServer::start(uint16_t portNumber, bool useSSL) {
// Design:
// The start of the HTTP server should be as fast as possible.
ESP_LOGD(LOG_TAG, ">> start: port: %d, useSSL: %d", portNumber, useSSL);
// Take the semaphore that says that we are now running. If we are already running, then end here as
// there is nothing further to do.
if (m_semaphoreServerStarted.take(100, "start") == false) {
ESP_LOGD(LOG_TAG, "<< start: Already running");
return;
}
m_useSSL = useSSL;
m_portNumber = portNumber;
// comment out below two lines to avoid linker error.
//HttpServerTask* pHttpServerTask = new HttpServerTask("HttpServerTask");
//pHttpServerTask->start(this);
ESP_LOGD(LOG_TAG, "<< start");
} // start
Re: C++ utils linker error
This was compiling/building few months back. Is WebSocket.cpp has changed recently?
Re: C++ utils linker error
Looks like its 3 months since last update.
Re: C++ utils linker error
Hi Guys,
I fixed the issue.
I found out the reason.
I removed -fno-rtti to allow in my components dynamic_cast. I can add -rtti in my own components.mk files.
cpputils needs -fno-rtti . if you need dynamic_cast in your own component than add into your own components.mk -rtti
Don't change esp-idf/make/project.mk
Thanks,
Naeem
I fixed the issue.
I found out the reason.
I removed -fno-rtti to allow in my components dynamic_cast. I can add -rtti in my own components.mk files.
cpputils needs -fno-rtti . if you need dynamic_cast in your own component than add into your own components.mk -rtti
Don't change esp-idf/make/project.mk
Thanks,
Naeem
Who is online
Users browsing this forum: Bing [Bot], Konstantin, MicroController and 132 guests