I'm trying to take a Qt C++ project originally written for Windows and cross compile it for embedded Linux. Now this program compiles find and works on Windows, so this problem must be something OS specific (which I didn't think happend with Qt code) or configuration related, but I'm having a hard time tracking it down because I don't fully understand C++ syntax.
my make command:
arm-linux-gnueabihf-g++ -c -march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -O2 -O3 -Wall -W -D_REENTRANT -DCHL80Net -DPHASE_TO_NEUTRAL -DCHL80NET -DCANLCD_BUILD -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../mkspecs/qws/linux-am335x-g++ -I. -I../include/QtCore -I../include/QtGui -I../include/QtXml -I../include -I. -IApp -IApp/Model/ModelSim -IApp/Model -I. -IPages -IApp/GUI/Widgets -IApp/GUI/Pages -IApp/GUI -IApp/GUI/Widgets -IApp/GUI/Pages/Util -IApp/GUI/Pages -IApp/Log4Qt -I.obj -o .obj/CanInterface.o App/Can/CanInterface.cpp
The error:
App/Can/CanInterface.cpp: In member function ‘void CanInterface::closeConnection()’: App/Can/CanInterface.cpp:68:5: error: ‘::close’ has not been declared make: * [.obj/CanInterface.o]
Error 1
Here's the line of code in question:
void CanInterface::closeConnection()
{
::close(m_socket);
m_socket = -1;
I thought this didn't look like valid code at all at first, but I don't really know C++ so I had to do a little research, it seems like this ::function()
syntax is to ensure resolution occurs from the global namespace instead of the local one.
So what I'm trying to find out is what namespace should have declaired this close()
function. If my understanding of this code is correct I don't need to look in the CanInterface
class for the undeclaired function, but it's parent class?
In the header file for the CanInterface
class I found this:
class CanInterface : public QObject
{
Q_OBJECT
which I think means that it inharents from a QObject
class. So:
- Am I on the right track?
- How do I know if I need to look at the
QObject
class for the missingclose()
function or if I need to keep going up? Does::close
somehow tell me how many levels of nested classes I need to search through? - Any other ideas or tips for further investigating this?