No warnings here:
#include <QtCore>
#include <QDebug>
int main(int argc, char **argv) {
ba.resize(5);
ba[0] = 0x3c;
ba[1] = 0xb8;
ba[2] = 0x64;
ba[3] = 0x18;
ba[4] = 0xca;
qDebug() << ba.toHex();
return 0;
}
#include <QtCore>
#include <QDebug>
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
QByteArray ba;
ba.resize(5);
ba[0] = 0x3c;
ba[1] = 0xb8;
ba[2] = 0x64;
ba[3] = 0x18;
ba[4] = 0xca;
qDebug() << ba.toHex();
return 0;
}
To copy to clipboard, switch view to plain text mode
$ make
g++ -c -pipe -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
g++ -Wl,-O1 -Wl,-rpath,/usr/lib64/qt4 -o test main.o -L/usr/lib64/qt4 -lQtGui -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
$ ./test
"3cb86418ca"
$ make
g++ -c -pipe -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
g++ -Wl,-O1 -Wl,-rpath,/usr/lib64/qt4 -o test main.o -L/usr/lib64/qt4 -lQtGui -L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
$ ./test
"3cb86418ca"
To copy to clipboard, switch view to plain text mode
Perhaps tell us what environment and compiler you are using, and what the warnings actually are.
Bookmarks