Using MPU6050 accelerometer/gyroscope module - arduino

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

Related

ESP32 AsyncWebServer

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"

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

Errors in generated MOC files for QT5 from cmake

I generated moc files for QT5 using
set (CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
Then I add the moc files into SRC using
SET(SRC
src/main.cpp
src/video_widget_surface.cpp
src/video_widget.cpp
src/video_player.cpp
#moc files
moc/moc_video_player.cpp
moc/moc_video_widget.cpp
moc/moc_video_widget_surface.cpp
Finally I add the executable using
add_executable(somegui ${SRC})
But I get errors in moc files saying :
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:54:6: error: 'VideoWidget' has not been declared
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:62:19: error: 'VideoWidget' has not been declared
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:68:20: error: 'VideoWidget' has not been declared
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:68:46: error: non-member function 'const QMetaObject* metaObject()' cannot have cv-qualifier
/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h: In function 'const QMetaObject* metaObject()':
/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h:401:33: error: 'QScopedPointer<QObjectData> QObject::d_ptr' is protected
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:70:21: error: within this context
/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h:401:33: error: invalid use of non-static data member 'QObject::d_ptr'
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:70:21: error: from this location
/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h:401:33: error: 'QScopedPointer<QObjectData> QObject::d_ptr' is protected
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:70:50: error: within this context
/other/Qt5.0.1/5.0.1/gcc_64/include/QtCore/qobject.h:401:33: error: invalid use of non-static data member 'QObject::d_ptr'
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:70:50: error: from this location
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: At global scope:
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:73:7: error: 'VideoWidget' has not been declared
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: In function 'void* qt_metacast(const char*)':
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:47: error: expected type-specifier before 'VideoWidget'
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:47: error: expected '>' before 'VideoWidget'
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:47: error: expected '(' before 'VideoWidget'
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:47: error: 'VideoWidget' was not declared in this scope
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:59: error: expected primary-expression before '>' token
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:61: error: invalid use of 'this' in non-member function
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:77:67: error: expected ')' before ';' token
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:78:40: error: cannot call member function 'virtual void* QWidget::qt_metacast(const char*)' without object
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: At global scope:
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:81:5: error: 'VideoWidget' has not been declared
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: In function 'int qt_metacall(QMetaObject::Call, int, void**)':
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:83:43: error: cannot call member function 'virtual int QWidget::qt_metacall(QMetaObject::Call, int, void**)' without object
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: In function 'void* qt_metacast(const char*)':
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp: In function 'const QMetaObject* metaObject()':
/other/workspace/perception/somestuff/moc/moc_video_widget.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
make[2]: *** [CMakeFiles/somestuff.dir/moc/moc_video_widget.cpp.o] Error 1
make[1]: *** [CMakeFiles/somestuff.dir/all] Error 2
make: *** [all] Error 2
My understanding is that there is some error in the moc files that are created. But I don't have any control over how that is created. Now how do I solve this bug ?
CMake documentation is not that bad, do not neglect reading it. You misunderstood the concept of AUTOMOC:
AUTOMOC is a boolean specifying whether CMake will handle the Qt moc preprocessor automatically, i.e. without having to use the QT4_WRAP_CPP() macro. Currently Qt4 is supported. When this property is set to TRUE, CMake will scan the source files at build time and invoke moc accordingly. If an #include statement like #include "moc_foo.cpp" is found, the Q_OBJECT class declaration is expected in the header, and moc is run on the header file. If an #include statement like #include "foo.moc" is found, then a Q_OBJECT is expected in the current source file and moc is run on the file itself. Additionally, all header files are parsed for Q_OBJECT macros, and if found, moc is also executed on those files.
So, first of all, you should not add generated moc files explicitly to sources and push them into executable compilation. In other words, you only push your sources:
SET(SRC
src/main.cpp
src/video_widget_surface.cpp
src/video_widget.cpp
src/video_player.cpp)
and moc ones are handled automatically by CMake.
Secondly, as stated in the documentation:
If Q_OBJECT is in the foo.h (i.e. QObject is declared in the header file),
then in the corresponding foo.cpp
don't forget to add #include "moc_foo.cpp", preferably at the end
of the file;
If Q_OBJECT is in the foo.cpp (i.e. QObject is declared in the source file),
then, again, in the foo.cpp itself
don't forget to add #include "foo.moc", preferably at the end
of the file.

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