MainWin.o(.text+0x7d1): In function `MainWin::getHostInformation()':
: undefined reference to `QHostInfo::localHostName()'
MainWin.o(.text+0x7e8): In function `MainWin::getHostInformation()':
: undefined reference to `QHostInfo::fromName(QString const&)'
MainWin.o(.text+0x7f4): In function `MainWin::getHostInformation()':
: undefined reference to `QHostInfo::addresses() const'
MainWin.o(.text+0x822): In function `MainWin::getHostInformation()':
: undefined reference to `QHostAddress::toString() const'
MainWin.o(.text+0x851): In function `MainWin::getHostInformation()':
: undefined reference to `QHostInfo::~QHostInfo [in-charge]()'
MainWin.o(.text+0x8d5): In function `MainWin::getHostInformation()':
: undefined reference to `QHostInfo::~QHostInfo [in-charge]()'
MainWin.o(.text+0x92e): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::allInterfaces()'
MainWin.o(.text+0x959): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::QNetworkInterface[in-charge](QNetwo
rkInterface const&)'
MainWin.o(.text+0x99e): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::name() const'
MainWin.o(.text+0xa7e): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::hardwareAddress() const'
MainWin.o(.text+0xac0): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::hardwareAddress() const'
MainWin.o(.text+0xba9): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::addressEntries() const'
MainWin.o(.text+0xc00): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::~QNetworkInterface [in-charge]()'
MainWin.o(.text+0xcdc): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::QNetworkAddressEntry[in-charge](
QNetworkAddressEntry const&)'
MainWin.o(.text+0xd6c): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::ip() const'
MainWin.o(.text+0xd81): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::toString() const'
MainWin.o(.text+0xe38): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.text+0xeed): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::netmask() const'
MainWin.o(.text+0xefc): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::toString() const'
MainWin.o(.text+0xfbc): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.text+0x1077): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::broadcast() const'
MainWin.o(.text+0x1086): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::toString() const'
MainWin.o(.text+0x1146): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.text+0x1188): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::~QNetworkAddressEntry [in-charge
]()'
MainWin.o(.text+0x143e): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkInterface::~QNetworkInterface [in-charge]()'
MainWin.o(.text+0x161d): In function `MainWin::slotDetail()':
: undefined reference to `QNetworkAddressEntry::~QNetworkAddressEntry [in-charge
]()'
MainWin.o(.text+0x16c5): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.text+0x17db): In function `MainWin::slotDetail()':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.gnu.linkonce.t._ZN5QListI12QHostAddressE13detach_helperEv+0x58): In f
unction `QList<QHostAddress>::detach_helper()':
: undefined reference to `QHostAddress::QHostAddress[in-charge](QHostAddress con
st&)'
MainWin.o(.gnu.linkonce.t._ZN5QListI12QHostAddressE4freeEPN9QListData4DataE+0x59
): In function `QList<QHostAddress>::free(QListData::Data*)':
: undefined reference to `QHostAddress::~QHostAddress [in-charge]()'
MainWin.o(.gnu.linkonce.t._ZN5QListI17QNetworkInterfaceE4freeEPN9QListData4DataE
+0x59): In function `QList<QNetworkInterface>::free(QListData::Data*)':
: undefined reference to `QNetworkInterface::~QNetworkInterface [in-charge]()'
MainWin.o(.gnu.linkonce.t._ZN5QListI20QNetworkAddressEntryE4freeEPN9QListData4Da
taE+0x59): In function `QList<QNetworkAddressEntry>::free(QListData::Data*)':
: undefined reference to `QNetworkAddressEntry::~QNetworkAddressEntry [in-charge
]()'
collect2: ld returned 1 exit status
make: *** [NetworkInfo] Error 1
相关代码段如下:
void MainWin :: getHostInformation()
{
QString localHostName=QHostInfo :: localHostName();
LineEditLocalHostName->setText(localHostName);
QHostInfo hostInfo=QHostInfo :: fromName(localHostName);
QList<QHostAddress> listAddress=hostInfo.addresses();
if(!listAddress.isEmpty())
{
LineEditAddress->setText(listAddress.first().toString());
}
}
void MainWin :: slotDetail()
{
QString detail="";
QList<QNetworkInterface> list=QNetworkInterface :: allInterfaces();
for(int i=0; i<list.count(); i++)
{
QNetworkInterface interface=list.at(i);
detail=detail + tr("Device: ") + interface.name() + "\n";
QString hardwareAddress=interface.hardwareAddress();
detail=detail + tr("HardwareAddress: ") + interface.hardwareAddress() + "\n";
QList<QNetworkAddressEntry> entryList=interface.addressEntries();
for(int j=0; j<entryList.count(); j++)
{
QNetworkAddressEntry entry=entryList.at(j);
detail=detail + "\t" + tr("IP Address: ") + entry.ip().toString() + "\n";
detail=detail + "\t" + tr("Netmask: ") + entry.netmask().toString() + "\n";
detail=detail + "\t" + tr("Broadcast: ") +entry.broadcast().toString() + "\n";
}
}
QMessageBox :: information(this, tr("Detail"), detail);
}
请哪位大侠指点,谢谢!!!