ESP32 AsyncWebServer - arduino

I currently trying to setup an Async Web Server on the ESP32. But unfortunately I don't get the code to run. I'm usign platform io on windows 10.
#include <Arduino.h>
#include <ESPAsyncWebServer.h>
const char* ssid = "myAP";
const char* password = "123456789";
AsyncWebServer server(80);
setup() and loop() are empty.
If I try to compile the code these message shows up.
compilation terminated.
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In constructor 'AsyncPrinter::AsyncPrinter(AsyncClient*, size_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:48:11: error: 'panic' was not declared in this scope
panic(); //What should we do?
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In member function 'int AsyncPrinter::connect(IPAddress, uint16_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:71:11: error: 'panic' was not declared in this scope
panic();
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp: In member function 'size_t AsyncPrinter::_sendBuffer()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\AsyncPrinter.cpp:182:11: error: 'panic' was not declared in this scope
panic(); // Connection should be aborted instead
^
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCPbuffer.cpp: In member function 'size_t AsyncTCPbuffer::_handleRxBuffer(uint8_t*, size_t)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCPbuffer.cpp:469:21: error: 'panic' was not declared in this scope
panic(); //TODO: What action should this be ?
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'bool AsyncClient::operator==(const AsyncClient&)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:331:66: error: 'ip_addr_t {aka struct ip_addr}' has no membec
r named 'addr'
return (_pcb != NULL && other._pcb != NULL && (_pcb->remote_ip.addr == other._pcb->remote_ip.addr) && (_pcb->remote_port == other._pcb->remote_port));
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'void AsyncClient::_dns_found(const ip_addr*)':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:707:31: error: 'const struct ip_addr' has no member named 'addr'
connect(IPAddress(ipaddr->addr), _connect_port);
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'uint32_t AsyncClient::getRemoteAddress()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:837:26: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
return _pcb->remote_ip.addr;
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'uint32_t AsyncClient::getLocalAddress()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:849:25: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
return _pcb->local_ip.addr;
^
C:\Users\x\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp: In member function 'void AsyncServer::begin()':
C:\Users\xanix\.platformio\lib\ESPAsyncTCP_ID305\src\ESPAsyncTCP.cpp:1122:14: error: 'ip_addr_t {aka struct ip_addr}' has no member named 'addr'
local_addr.addr = (uint32_t) _addr;
^

You're using the wrong async TCP library. The one you're using is for the ESP8266, not the ESP32.
Here's its PlatformIO library registry entry:
https://platformio.org/lib/show/305/ESPAsyncTCP
You're seeing errors because it's trying to call functions that are available on the ESP8266 and not the ESP32.
You want the AsyncTCP library:
https://platformio.org/lib/show/1826/AsyncTCP
You should update your platformio.lib file to include this library instead of ESPAsyncTCP. You may also need to remove the build or library directory to get rid of the old library.

had the same issue, downgrading the core of PlatformIO solved for me the issue.
pip install -U "platformio<4.2.0"

Related

Error when building nginx docker

I am trying to build a docker from a fork and I am getting the following error when performing docker build ./:
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
On install we run
apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget
I can't find this error on google. The full error for reference as I can't find out the exact error reference I need to research:
src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
OPENSSL_config(NULL);
^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
from /usr/include/openssl/ssl.h:61,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
key = RSA_generate_key(512, RSA_F4, NULL, NULL);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from /usr/include/openssl/x509.h:31,
from /usr/include/openssl/ssl.h:50,
from src/event/ngx_event_openssl.h:15,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
if (c->ssl->connection->s3) {
^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int, int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int, int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int, int *)}'
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
EVP_MD_CTX md;
^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
EVP_MD_CTX_cleanup(&md);
^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
RAND_pseudo_bytes(iv, 16);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
from src/event/ngx_event_openssl.h:22,
from src/core/ngx_core.h:80,
from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2
This is the docker fork I am running https://github.com/meteorhacks/mup-frontend-server
You are getting various errors and warnings here, but they aren't really about Docker or OpenSSL. If we strip away the extraneous information, here are the problems you are encountering.
error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated
The core of the problem here is probably that you are using a legacy version of Nginx in this project. From the GitHub repository you pointed to, in install-nginx.sh:
NGINX_VERSION=1.8.0
The current mainline version of Nginx is 1.13.2. I haven't combed through the changelogs for Nginx, but based on the errors you are receiving, it seems likely that between the 1.8 releases and the current ones, OpenSSL has deprecated various functions that Nginx 1.8 relied on. Most likely this can be solved by moving to a recent release of Nginx.
As of this writing, 1.13.2 is the current mainline, and 1.12.0 is the current stable. One of those may work better. Whether you can simply drop this in, I can't say. You may have to change something in the build scripts or the nginx config for a more recent version to work properly.
you are getting this error because your nginx version don't support SSL 1.1.0. Either upgrade NGINX version or use SSL 1.0.2.

Compilation issues with ntopng

I am trying to install ntopng on CentOS 5.5. When I run the make command, during the compilation process I am getting an error related to the sqlite library. I have sqlite v3.3.6 installed.
src/../third-party/lsqlite3/lsqlite3.c: In function 'int dbvm_get_name(lua_State*)':
src/../third-party/lsqlite3/lsqlite3.c:344: warning: converting to 'int' from 'lua_Number'
src/../third-party/lsqlite3/lsqlite3.c: In function 'int dbvm_get_type(lua_State*)':
src/../third-party/lsqlite3/lsqlite3.c:352: warning: converting to 'int' from 'lua_Number'
src/../third-party/lsqlite3/lsqlite3.c: In function 'int dbvm_bind_parameter_name(lua_State*)':
src/../third-party/lsqlite3/lsqlite3.c:501: warning: converting to 'int' from 'lua_Number'
src/../third-party/lsqlite3/lsqlite3.c: In function 'int db_create_collation(lua_State*)':
src/../third-party/lsqlite3/lsqlite3.c:1191: error: 'sqlite3_create_collation_v2' was not declared in this scope
src/../third-party/lsqlite3/lsqlite3.c: At global scope:
src/../third-party/lsqlite3/lsqlite3.c:1261: error: 'sqlite3_int64' has not been declared
src/../third-party/lsqlite3/lsqlite3.c: In function 'int db_update_hook(lua_State*)':
src/../third-party/lsqlite3/lsqlite3.c:1311: error: invalid conversion from 'void (*)(void*, int, const char*, const char*, int)' to 'void (*)(void*, int, const char*, const char*, sqlite_int64)'
src/../third-party/lsqlite3/lsqlite3.c:1311: error: initializing argument 2 of 'void* sqlite3_update_hook(sqlite3*, void (*)(void*, int, const char*, const char*, sqlite_int64), void*)'
src/../third-party/lsqlite3/lsqlite3.c: In function 'int db_exec_callback(void*, int, char**, char**)':
src/../third-party/lsqlite3/lsqlite3.c:1617: warning: converting to 'int' from 'lua_Number'
src/../third-party/lsqlite3/lsqlite3.c: At global scope:
src/../third-party/lsqlite3/lsqlite3.c:1979: error: 'SQLITE_CREATE_VTABLE' was not declared in this scope
src/../third-party/lsqlite3/lsqlite3.c:1980: error: 'SQLITE_DROP_VTABLE' was not declared in this scope
src/../third-party/lsqlite3/lsqlite3.c:1981: error: 'SQLITE_FUNCTION' was not declared in this scope
src/../third-party/lsqlite3/lsqlite3.c:1983: error: 'SQLITE_SAVEPOINT' was not declared in this scope
make: *** [src/Lua.o] Error 1
I resolved this issue by installing the latest sqlite package from source -> 3.8.10.2

Using MPU6050 accelerometer/gyroscope module

I'm testing my MPU6050 module with Arduino Mega. I found Jeff Rowberg has written a library for this. I tried with this example provided by him. But the Arduino IDE gives a large number of errors when trying to verify the sketch.
I've already installed Jeffs library. (following image shows the library content)
This is the error I'm getting:
In file included from C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:42,
from sketch_dec08a.cpp:50:
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050.h:792: warning: only initialized variables can be placed into program memory area
In file included from sketch_dec08a.cpp:50:
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:89: warning: only initialized variables can be placed into program memory area
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:89: error: conflicting declaration 'const prog_uchar dmpMemory [1929]'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050.h:792: error: 'dmpMemory' has a previous declaration as 'prog_uchar dmpMemory [1929]'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:229: warning: only initialized variables can be placed into program memory area
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:271: warning: only initialized variables can be placed into program memory area
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:271: error: conflicting declaration 'const prog_uchar dmpUpdates [47]'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050.h:931: error: 'dmpUpdates' has a previous declaration as 'uint8_t dmpUpdates [29][9]'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:281: error: no 'uint8_t MPU6050::dmpInitialize()' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:506: error: no 'bool MPU6050::dmpPacketAvailable()' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:533: error: no 'uint8_t MPU6050::dmpGetAccel(int32_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:541: error: no 'uint8_t MPU6050::dmpGetAccel(int16_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:549: error: no 'uint8_t MPU6050::dmpGetAccel(VectorInt16*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:557: error: no 'uint8_t MPU6050::dmpGetQuaternion(int32_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:566: error: no 'uint8_t MPU6050::dmpGetQuaternion(int16_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:575: error: no 'uint8_t MPU6050::dmpGetQuaternion(Quaternion*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:590: error: no 'uint8_t MPU6050::dmpGetGyro(int32_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:598: error: no 'uint8_t MPU6050::dmpGetGyro(int16_t*, const uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:608: error: no 'uint8_t MPU6050::dmpGetLinearAccel(VectorInt16*, VectorInt16*, VectorFloat*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:616: error: no 'uint8_t MPU6050::dmpGetLinearAccelInWorld(VectorInt16*, VectorInt16*, Quaternion*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:628: error: no 'uint8_t MPU6050::dmpGetGravity(VectorFloat*, Quaternion*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:639: error: no 'uint8_t MPU6050::dmpGetEuler(float*, Quaternion*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:645: error: no 'uint8_t MPU6050::dmpGetYawPitchRoll(float*, Quaternion*, VectorFloat*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:658: error: no 'uint8_t MPU6050::dmpProcessFIFOPacket(const unsigned char*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:668: error: no 'uint8_t MPU6050::dmpReadAndProcessFIFOPacket(uint8_t, uint8_t*)' member function declared in class 'MPU6050'
C:\Users\LordXaX\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:693: error: no 'uint16_t MPU6050::dmpGetFIFOPacketSize()' member function declared in class 'MPU6050'
sketch_dec08a.cpp: In function 'void setup()':
sketch_dec08a.cpp:177: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:181: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:182: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:182: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:185: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:191: warning: only initialized variables can be placed into program memory area
sketch_dec08a:187: error: 'class MPU6050' has no member named 'dmpInitialize'
sketch_dec08a.cpp:197: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:201: warning: only initialized variables can be placed into program memory area
sketch_dec08a:198: error: 'class MPU6050' has no member named 'getIntStatus'
sketch_dec08a.cpp:206: warning: only initialized variables can be placed into program memory area
sketch_dec08a:205: error: 'class MPU6050' has no member named 'dmpGetFIFOPacketSize'
sketch_dec08a.cpp:216: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp:218: warning: only initialized variables can be placed into program memory area
sketch_dec08a.cpp: In function 'void loop()':
sketch_dec08a:246: error: 'class MPU6050' has no member named 'getIntStatus'
sketch_dec08a.cpp:260: warning: only initialized variables can be placed into program memory area
sketch_dec08a:263: error: 'class MPU6050' has no member named 'getFIFOBytes'
How do I overcome this?
I've been trying very hard to use this device to get acceleration/gyroscope values. But still no success.
EDIT
This is what I get when trying to compile (verify).
The MPU6050_DMP6 example provided by Jeff works for me. From your compile error, it seems that you've included MPU6050.h, instead of MPU6050_6Axis_MotionApps20.h. Make sure you include the correct one.
If you look at the library code, you'll notice that the .dmp___ methods are not implemented in the MPU6050.cpp file, but in the MPU6050_6Axis_MotionApps20.h file. If this doesn't solve it, post your code.
try putting jeffs i2c .cpp and .h files into the same folder as the mpu6050 library files i found that this then worked for me, sorry if this is a litte late but hopefully helpful :P
I was having the same problem and it turned out I was including both
MPU6050.h and MPU6050_6Axis_MotionApps20.h. I commented out MPU6050.h and it now compiles fine. Seems that the former was overriding the latter.
I've solved the compile problem by putting I2Cdev.cpp and I2C.h in the MPU6050 library folder. (Mind: these are the dev files). These are Jeff's libraries and can be found at GitHub

Error while compiling: invalid conversion from 'void*' to 'unsigned char*'

Im programming an Arduino mega 2560.
And I bought an tft LCD and for that I want to use a SD card so I can put my pictures on it.
I downloaded this library but its giving me errors.
C:\Arduino\libraries\pff\pff.cpp: In function 'FRESULT pf_read(void*, short unsigned int, short unsigned int*)':
C:\Arduino\libraries\pff\pff.cpp:585: error: invalid conversion from 'void*' to 'unsigned char*'
The problem is imo here:
pff.cpp:
FRESULT pf_read (
void* buff, /* Pointer to the read buffer (NULL:Forward data to the stream)*/
WORD btr, /* Number of bytes to read */
WORD* br /* Pointer to number of bytes read */
)
pff.h:
FRESULT pf_read (void*, WORD, WORD*); /* Read data from the open file */
When I make it a .c file, it gives me more errors, like this one:
tft_menu.cpp.o: In function `open_root_dir()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:594: undefined reference to `pf_opendir(_DIR_*, char const*)'
tft_menu.cpp.o: In function `mount_sd()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:583: undefined reference to `disk_initialize()'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:585: undefined reference to `pf_mount(_FATFS_*)'
tft_menu.cpp.o: In function `bitmap_show(char*)':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:472: undefined reference to `pf_open(char const*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:476: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:518: undefined reference to `pf_read(void*, unsigned short, unsigned short*)'
tft_menu.cpp.o: In function `show_bitmap()':
C:\AppData\Local\Temp\build7310099894910129341.tmp/tft_menu.cpp:603: undefined reference to `pf_readdir(_DIR_*, _FILINFO_*)'
so I think it should be compiled as a cpp.
EDIT:
I found out that I have to save is as cpp and in the program I have to write what icktoofay states
After that I got some errors, so I went to the line 585, as stated above and changed
BYTE *rbuff = buff;
into
BYTE rbuff = (unsigned char) buff;
And I found out that I had to add mcc.h to get rid of the errors of the "couldnt find resources".
And now Im getting these errors:
C:\libraries\mmc/mmc.h: In function 'void init_spi()':
C:\libraries\mmc/mmc.h:21: error: 'PORTL' was not declared in this scope
C:\libraries\mmc/mmc.h:21: error: 'PORTL0' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB2' was not declared in this scope
C:\libraries\mmc/mmc.h:22: error: 'PORTB1' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'DDRB' was not declared in this scope
C:\libraries\mmc/mmc.h:23: error: 'PORTB0' was not declared in this scope
C:\libraries\mmc/mmc.h:25: error: 'DDRL' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPCR' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'SPE' was not declared in this scope
C:\libraries\mmc/mmc.h:27: error: 'MSTR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPSR' was not declared in this scope
C:\libraries\mmc/mmc.h:28: error: 'SPI2X' was not declared in this scope
Ive tried to add #include TFT_ARDUINO_MEGA.h on top of the mcc.h and still no luck
Compile it as a C file, but in the file that uses it, include pff.h like this:
extern "C" {
#include <pff.h>
}

Qt forbid declaration of QListView with no type

I have a very strange error in my Qt project. Here is the code, the main_window.h:
#include <QtGui>
#include <QtSql>
class main_window : public QTabWidget
{
Q_OBJECT
/// #name List Widgets
private:
QListWidget* m_documents_list;
....
and here is main_window.cpp:
...
void main_window::create_documents_widget()
{
m_documents = new QWidget(this);
m_documents_list = new QListWidget(m_documents);
}
...
The problem that I can't understand is in QListView, I'm not using it in my project. There is only QListWidget, but when I'm trying to build the project the following errors occur:
qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
qlistview.h:194: error: expected ',' or '...' before '&' token
Also the following strange errors:
qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:314: error: no 'QListWidgetItem QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'*
etc.
Thanks in advance.
UPD: I'm using QtCreator 2.2.1 on Windows 7.
UPD2: Qt version is 4.7.1.
UPD3: The complete output
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:68,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ',' or '...' before '&' token
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ';' before '&' token
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:69,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:202: error: redefinition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:58: error: previous definition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:314: error: no 'QListWidgetItem* QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setSelected(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:318: error: 'class QListWidget' has no member named 'setItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isSelected() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:321: error: 'class QListWidget' has no member named 'isItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setHidden(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:324: error: 'class QListWidget' has no member named 'setItemHidden'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isHidden() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:327: error: 'class QListWidget' has no member named 'isItemHidden'
Firstly - you should also mention qt version, as in this case that's most important.
This seems like some weird quirk of compiler or qt - my recomendation would be first to create simplest program where problem occurs. If it shows also in program like
#include <QtGui/QListWidget>
int main(int argc, char* argv[]){
QListWidget* w = 0;
}
then it is some problem with qt headers of compiler - then answer cannot be provided from data provided. If it works, then try to slowly add other elements of your code to this simple file - most likely at some point you will get the same error again - then you will know that last added piece of code is guilty. Some additional thinking might be required to figure out how to remove problem once located.
It should be noted that QListWidget inherits from QListView, so you are indirectly using it.
The error your getting looks like you're simply missing a #include <QListWidget> line in your header file.
Also, it could be that that you're missing #include guards in your header file
#ifndef MYCLASS
#define MYCLASS
class MyClass { ... };
#endif
If your header file is #included by more than one project then that would explain the errors you're seeing.

Resources