Compile error in Arduino IDE using Mozzi library - arduino

I'm using the Mozzi lib (http://sensorium.github.io/Mozzi/) as part of a tutorial (http://www.echanter.com/home/howto-build#TOC-Arduino-IDE). I included the Mozzi in Arduino Studio and followed minor configs in the tutorial. I've looked around the lines that are reported, but I'm stumped. Compile error is:
Mozzi/mozzi_fixmath.cpp.o: In function isqrt16(unsigned int)': /home/temp/sketchbook/libraries/Mozzi/mozzi_fixmath.cpp:156: multiple definition of isqrt32(unsigned long)'
echanter.cpp.o:/home/temp/sketchbook/libraries/Mozzi/Sample.h:61: first defined here
collect2: error: ld returned 1 exit status

In the root dir are two files with isqrt16(unsigned int) defined: mozzi_fixmath.cpp and mozzi_fixmath.h. I commented out the definition in the cpp file and it compiled.

Related

error: cannot find -lc++ clang++: error: linker command failed with exit code 1

I'm having no luck running the Qt examples with Qt Creator. I've tried three so far, but I have been unable to build and run any of them.
and also it showing as QML module not found for QtQuickVirtualKeyboard import.
i have attached the error screenshot.
error: cannot find -lc++
clang++: error: linker command failed with exit code 1
The error: cannot find -lc++ using ndk r20 can be solved like this:
https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34][1]
For example to compile for android armv7 ndk r20, locate the file:
C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
and add the missing -nostdlib++
for android x86 (i use this for emulator), locate the file:
C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf

Linker error caused by Qt qjpeg4?

I cannot link my project because of some issues with the qjpeg4 library.
Its DLL is located here:
PROJECT_ROOT/../Release/obj/imageformats/qjpeg4.dll
I get this linker error:
Linking CXX executable test.exe
CMakeFiles\test.dir/objects.a(entrypoint.cpp.obj):entrypoint.cpp:(.text.startup+0x2692): undefined reference to `qt_plugin_instance_qjpeg()'
collect2: ld returned 1 exit status
In the file containing main() I have: Q_IMPORT_PLUGIN(qjpeg)
I tried adding these lines, with no improvement:
QApplication app(argc, argv);
QString sDir = QCoreApplication::applicationDirPath();
app.addLibraryPath(sDir + "/plugins");
The previous error should even not depend on the fact that the DLL has not been found, since it is still in the link phase...
If in the file containing main() I remove Q_IMPORT_PLUGIN(qjpeg), the linker is successful, but the executable does absolutely nothing.
The only Qt headers I include are <QApplication> and <QtPlugin>; adding <QtGui> has been useless.
From this link, it seems to be a bug in Qt:
https://bugreports.qt-project.org/browse/QTBUG-24177

QT Creator: undefined reference to 'WinMain#16'

I am building a Unit-Test using this tutorial. However, when compiling my code I get these two errors:
undefined reference to 'WinMain#16'.
collect2: ld returned 1 exit status.
why is this happening?
Did you create a main function where you create a qapplication? There's a good example here
You can also get that error when you're creating a DOS executable instead of a Windows GUI executable. It's looking for winmain() not main(),

Qt: Building quazip/zlib Library error

I am statically building the quazip library as mentioned in the following post: linking QuaZip with Qt 4.8.0 into project
I get these error when I build the project:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zconf.h:373:6: error: "_LARGEFILE64_SOURCE" is not defined
In file included from ../../../quazip-0.4.4/quazip/zip.h:56,
from ../../../quazip-0.4.4/quazip/quazip.h:31,
from ../../../quazip-0.4.4/quazip/quazipfile.h:30,
from ../../../quazip-0.4.4/quazip/quazipfile.cpp:24:
/QtSDK/QtSources/4.8.0/src/3rdparty/zlib/zlib.h:1583:32: error: "_FILE_OFFSET_BITS" is not defined
cc1plus: warnings being treated as errors
Are these known errors in zlib library? I am using zlib library in Qt 4.8.0
That would be a bug in your compiler. I can't tell what version of zlib you're using, and your compiler does not show the offending line in the error message, so I can't tell exactly what the line contains. However I suspect that these are lines that have an #if directive with the noted symbol in the expression. Per the C standard, a symbol that is not defined is given a null value (no characters replace it) in an expression in an #if statement. Instead your compiler is erroneously issuing an error.

Qmake build and gcc includes

I am working with Qt and kinda new to it. I want to build a Qt application and created devprog.pro file. However, after executing qmake and make I get the error
c:\qt473\include\qtcore../../src/corelib/global/qglobal.h(45)
: fatal error C10 83: Cannot open
include file: 'stddef.h': No such file
or directory
So I specified the gcc 4.4.1 include location and the error messages (amongst others) I get is:
c:\codeblocks\MinGW\lib\gcc\mingw32\4.4.1\include\stddef.h(211)
: error C2371: ' size_t' :
redefinition; different basic types
predefined C++ types (compiler internal)(19) : see declaration of
'size_ t'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C2143: syntax error : missing
';' before '*'
C:\CodeBlocks\MinGW\include\string.h(126)
: error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
My question is:
1. How can resolve such error problems as I've scratched my hair off trying to solve this.
2. Is there a way to make automatically let qmake detect your main gcc mingw location without having to set it for each project during qmake execution?

Resources