QT IPERF3 = LCONV尚未声明

Qt + iperf3 = lconv has not been declared

本文关键字:未声明 LCONV IPERF3 QT      更新时间:2023-10-16

对不起我的英语。

我尝试将IPERF3(例如静态链接库)添加到我的QT项目(QT版本4.8.5,OpenSuse 13.1),并有几个错误:

g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../lperftest -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I../lperf/include -I. -I../lperftest -I. -o main.o ../lperftest/main.cpp
In file included from /usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:41:0,
from /usr/include/c++/4.8/bits/localefwd.h:40,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/clocale:53:11: error: '::lconv' has not been declared
using ::lconv;
^
/usr/include/c++/4.8/clocale:54:11: error: '::setlocale' has not been declared
using ::setlocale;
^
/usr/include/c++/4.8/clocale:55:11: error: '::localeconv' has not been declared
using ::localeconv;
^
In file included from /usr/include/c++/4.8/bits/localefwd.h:40:0,
from /usr/include/c++/4.8/string:43,
from /usr/include/QtCore/qstring.h:54,
from /usr/include/QtCore/qobject.h:48,
from /usr/include/QtCore/QObject:1,
from ../lperftest/main.cpp:9:
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:23: error: 'uselocale' was not declared in this scope
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:52:45: error: invalid type in declaration before ';' token
extern "C" __typeof(uselocale) __uselocale;
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h: In function 'int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)':
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:75:53: error: '__gnu_cxx::__uselocale' cannot be used as a function
__c_locale __old = __gnu_cxx::__uselocale(__cloc);
^
/usr/include/c++/4.8/x86_64-suse-linux/bits/c++locale.h:100:33: error: '__gnu_cxx::__uselocale' cannot be used as a function
__gnu_cxx::__uselocale(__old);
^
../lperftest/main.cpp: At global scope:
../lperftest/main.cpp:11:5: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char *argv[])
^
../lperftest/main.cpp:11:5: warning: unused parameter 'argv' [-Wunused-parameter]
make: *** [main.o] Error 1

当我尝试将iPERF3添加到唯一的C 项目时,全部都很好。此错误仅在QT项目中存在。有什么想法吗?

我对IPERF3和QT也有同样的问题。基本上,似乎您必须为IPERF3库和您的项目使用类似的汇编(GCC或G )。

让我们知道情况如何。或分享您的解决方案(如果已经完成)。

- 编辑 - 或为iperf_api.h

做以下操作
extern "C" {
#include <iperf_api.h>
}