提问人:famedoro 提问时间:9/19/2022 最后编辑:famedoro 更新时间:9/21/2022 访问量:148
gSoap MinGW 编译错误_set_errno未在此范围内声明
gSoap MinGW compilation error _set_errno was not declared in this scope
问:
我正在尝试在 Windows XP 32 位中编译 gsoap_2.8.123 版本(我意识到它很旧,但对于要执行的项目,我别无选择)
我使用 MinGW(安装在 )作为编译器,并使用命令运行 mintty。C:\MinGW
msys.bat beautify mintty
在薄荷里面我跑了所以我跑了,我得到以下错误./configure
make
In file included from stdsoap2_cpp.cpp:65:0:
stdsoap2_cpp.cpp: In function 'SOCKET soap_accept(soap*)':
stdsoap2.h:1158:40: error: '_set_errno' was not declared in this scope
# define soap_reset_errno _set_errno(0)
^
stdsoap2_cpp.cpp:7037:3: note: in expansion of macro 'soap_reset_errno'
soap_reset_errno;
^~~~~~~~~~~~~~~~
我试过了./configure --includedir="C:\MinGW\lib\gcc\mingw32\6.3.0\include"
或
./configure --includedir="/MinGW/lib/gcc/mingw32/6.3.0/include"
没有成功
在被报告config.log
configure:6317: checking for errno.h
configure:6317: gcc -c -g -O2 conftest.c >&5
configure:6317: $? = 0
configure:6317: result: yes
...
configure:6407: checking for sys/socket.h
configure:6407: gcc -c -g -O2 conftest.c >&5
conftest.c:64:24: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>
更新*******
我已经安装了 msys-gcc,里面有我需要的头文件,C:\MinGW\msys\1.0\include
我试过了,但一直收到错误./configure --includedir="/MinGW/msys/1.0/include/"
checking for sys/socket.h ... no
更新*****
要设置包含目录,我设置了环境变量:
SET CPPFLAGS=-I"C:\MinGW\msys\1.0\include" -I"C:\MinGW\include"
现在在编译过程中使用,如下所示,其中注意到_set_errno问题仍然存在:
make[4]: Entering directory `/c/PrgEda/Installazioni/gSoap/gsoap-2.8/gsoap'
gcc -DHAVE_CONFIG_H -I. -I.. -IC:\MinGW\msys\1.0\include -IC:\MinGW\include
-DMINGW -MT libgsoap_a-stdsoap2.o -MD -MP -MF .deps/libgsoap_a-stdsoap2.Tpo
-c -o libgsoap_a-stdsoap2.o `test -f 'stdsoap2.c' || echo './'`stdsoap2.c
In file included from stdsoap2.c:65:0:
stdsoap2.c: In function 'soap_accept':
stdsoap2.h:1158:28: warning: implicit declaration of function '_set_errno' [-Wimplicit-function-declaration]
# define soap_reset_errno _set_errno(0)
^
stdsoap2.c:7037:3: note: in expansion of macro 'soap_reset_errno'
soap_reset_errno;
更新*******
在stdsoap2.h中,我替换了
#define soap_reset_errno _set_errno(0)
跟
#define soap_reset_errno (errno = ENOENT)
我设置了
export CPPFLAGS="-I/MinGW/msys/1.0/include/ -I/MinGW/include/ -m32 -std=gnu++11 -DWITH_NO_C_LOCALE"
export CXXFLAGS="-I/MinGW/msys/1.0/include/ -I/MinGW/include/ -m32 -std=gnu++11 -DWITH_NO_C_LOCALE"
但现在我有这个错误:
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\postypes.h:40:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iosfwd:40,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ios:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ostream:38,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\iterator:64,
from stdsoap2.h:752,
from stdsoap2_cpp.cpp:65:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:64:11: error: '::mbstate_t' has not been declared
using ::mbstate_t;
^~~~~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:141:11: error: '::btowc' has not been declared
using ::btowc;
^~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:142:11: error: '::fgetwc' has not been declared
using ::fgetwc;
^~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:143:11: error: '::fgetws' has not been declared
using ::fgetws;
...
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar: In function 'wchar_t* std::wcschr(wchar_t*, wchar_t)':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cwchar:213:19: error: invalid conversion from 'const wchar_t*' to 'wchar_t*' [-fpermissive]
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
更新
我已经从 CPPFLAGS 和 CXXFLAGS 变量中删除了包含,现在我不再有编译错误
更新
有了上述迹象,我能够编译 soapcpp2.exe,现在我想编译支持 ssl 的 wsdl2h.exe,请参阅如何使用支持 ssl 的 MinGW 编译 gSoap wsdl2h.exe
如何使用编译参数包含正确的编译指令?
似乎脚本没有处理参数configure
includedir
答: 暂无答案
评论
sys/socket.h
在 MinGW 中不存在。但是用线条替换它很多时候都有效。我自己完全能够使用 MinGW-w2.8.123 构建 gSOAP 64,而无需调整。我使用以下标志:winsock2.h
#include
configure
--enable-gnutls --disable-samples
gcc
-I
-L