Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 与MinGW STL碰撞(错误:全局命名空间中没有名为';fgetws';的成员)_C++_Stl_Compiler Errors_Mingw_Clang - Fatal编程技术网

C++ 与MinGW STL碰撞(错误:全局命名空间中没有名为';fgetws';的成员)

C++ 与MinGW STL碰撞(错误:全局命名空间中没有名为';fgetws';的成员),c++,stl,compiler-errors,mingw,clang,C++,Stl,Compiler Errors,Mingw,Clang,我正试图在windows下使用MinGW STL(Clang和MinGW的最新版本)编译一个带有Clang的简单dll。如您所见,我已禁用ms兼容模式和硬编码VS标头。当我包含MinGW STL映射头时,会出现以下错误: C:\Program Files (x86)\LLVM\vc11\bin\Debug>clang++ -fno-ms-compatibility -nostdinc -c -shared -v -o simple.o simple.cpp -I "C:\MinGW\inc

我正试图在windows下使用MinGW STL(Clang和MinGW的最新版本)编译一个带有Clang的简单dll。如您所见,我已禁用ms兼容模式和硬编码VS标头。当我包含MinGW STL映射头时,会出现以下错误:

C:\Program Files (x86)\LLVM\vc11\bin\Debug>clang++ -fno-ms-compatibility -nostdinc -c -shared -v -o simple.o simple.cpp -I "C:\MinGW\include\sys" -I "C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include" -I "C:\MinGW\include" -I "C:\MinGW\include\c++" -I "C:\MinGW\include\c++\4.8.0" -I "C:\MinGW\include\c++\4.8.0\backward" -I "C:\MinGW\include\c++\4.8.0\bits" -I "C:\MinGW\include\c++\4.8.0\debug" -I "C:\MinGW\include\c++\4.8.0\decimal" -I "C:\MinGW\include\c++\4.8.0\ext" -I "C:\MinGW\include\c++\4.8.0\i686-pc-mingw32" -I "C:\MinGW\include\c++\4.8.0\tr1" -I "C:\MinGW\include\c++\4.8.0\tr2" -I "C:\MinGW\include\c++\4.8.0\profile" -Wl,--verbose
clang version 3.4 (trunk)
Target: i686-pc-win32
Thread model: posix
clang++.exe: warning: -Wl,--verbose: 'linker' input unused
clang++.exe: warning: argument unused during compilation: '-shared'
 "C:/Program Files (x86)/LLVM/vc11/bin/Debug/clang++.exe" -cc1 -triple i686-pc-win32 -emit-obj -mrelax-all -disable-free -main-file-name simple.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -v -coverage-file simple.o -nostdsysteminc -nobuiltininc -resource-dir "C:/Program Files (x86)/LLVM/vc11/bin/Debug\\..\\lib\\clang\\3.4" -I "C:\\MinGW\\include\\sys" -I "C:\\MinGW\\lib\\gcc\\i686-pc-mingw32\\4.8.0\\include" -I "C:\\MinGW\\include" -I "C:\\MinGW\\include\\c++" -I "C:\\MinGW\\include\\c++\\4.8.0" -I "C:\\MinGW\\include\\c++\\4.8.0\\backward" -I "C:\\MinGW\\include\\c++\\4.8.0\\bits" -I "C:\\MinGW\\include\\c++\\4.8.0\\debug" -I "C:\\MinGW\\include\\c++\\4.8.0\\decimal" -I "C:\\MinGW\\include\\c++\\4.8.0\\ext" -I "C:\\MinGW\\include\\c++\\4.8.0\\i686-pc-mingw32" -I "C:\\MinGW\\include\\c++\\4.8.0\\tr1" -I "C:\\MinGW\\include\\c++\\4.8.0\\tr2" -I "C:\\MinGW\\include\\c++\\4.8.0\\profile" -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 150 -mstackrealign -fms-extensions -fmsc-version=1300 -fdelayed-template-parsing -fobjc-runtime=gcc -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops -o simple.o -x c++ simple.cpp
clang -cc1 version 3.4 based upon LLVM 3.4svn default target i686-pc-win32
#include "..." search starts here:
#include <...> search starts here:
 C:\MinGW\include\sys
 C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include
 C:\MinGW\include
 C:\MinGW\include\c++
 C:\MinGW\include\c++\4.8.0
 C:\MinGW\include\c++\4.8.0\backward
 C:\MinGW\include\c++\4.8.0\bits
 C:\MinGW\include\c++\4.8.0\debug
 C:\MinGW\include\c++\4.8.0\decimal
 C:\MinGW\include\c++\4.8.0\ext
 C:\MinGW\include\c++\4.8.0\i686-pc-mingw32
 C:\MinGW\include\c++\4.8.0\tr1
 C:\MinGW\include\c++\4.8.0\tr2
 C:\MinGW\include\c++\4.8.0\profile
End of search list.
In file included from simple.cpp:3:
In file included from C:\MinGW\include\c++\4.8.0\map:61:
In file included from C:\MinGW\include\c++\4.8.0\bits/stl_map.h:63:
In file included from C:\MinGW\include\c++\4.8.0\tuple:39:
In file included from C:\MinGW\include\c++\4.8.0\array:38:
In file included from C:\MinGW\include\c++\4.8.0\stdexcept:39:
In file included from C:\MinGW\include\c++\4.8.0\string:40:
In file included from C:\MinGW\include\c++\4.8.0\bits/char_traits.h:40:
In file included from C:\MinGW\include\c++\4.8.0\bits/postypes.h:40:
C:\MinGW\include\c++\4.8.0\cwchar:143:11: error: no member named 'fgetws' in the global namespace
  using ::fgetws;
        ~~^
C:\MinGW\include\c++\4.8.0\cwchar:145:11: error: no member named 'fputws' in the global namespace
  using ::fputws;
        ~~^
C:\MinGW\include\c++\4.8.0\cwchar:149:11: error: no member named 'getwc' in the global namespace
  using ::getwc;
        ~~^
C:\MinGW\include\c++\4.8.0\cwchar:150:11: error: no member named 'getwchar' in the global namespace
  using ::getwchar;
        ~~^
C:\MinGW\include\c++\4.8.0\cwchar:155:11: error: no member named 'putwc' in the global namespace
  using ::putwc;
        ~~^
C:\MinGW\include\c++\4.8.0\cwchar:156:11: error: no member named 'putwchar' in the global namespace
  using ::putwchar;
        ~~^
6 errors generated.
C:\Program Files(x86)\LLVM\vc11\bin\Debug>clang++-fno-ms compatibility-nostdinc-C-shared-v-o simple.o simple.cpp-I“C:\MinGW\include\sys”-I“C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\ include”-I“C:\MinGW\include\C++-I”C:\MinGW\include\C++“C:\MinGW\include\C++\4.8.0\bits”-I“C:\MinGW\include\C++\4.8.0\debug”-I“C:\MinGW\include\C++\4.8.0\bits”-I“C:\MinGW\include\C++\4.8.0\i686-pc-mingw32”-I“C:\MinGW\include\C++\C++\C++\4.8.0\tr1”-I“C:\MinGW\include\C++\C++\C++\include\C++\C.8.0\tr1”-C:\MinGW\include\C++\4.8.0”-verbose-8.0
叮当3.4版(主干)
目标:i686-pc-win32
线程模型:posix
clang++.exe:警告:-Wl,--verbose:“链接器”输入未使用
clang++.exe:警告:编译期间未使用参数:'-shared'
“C:/Program Files(x86)/LLVM/vc11/bin/Debug/clang++.exe”-cc1-triple i686-pc-win32-emit obj-mrelax all-disable free-main file name simple.cpp-mrelocation model static-mdisable fp elim-fmath errno-masm verbose-mconstructor别名-目标cpu pentium4-v-coverage file simple.o-nostSysteminc-nobuiltinic-resource dir”C:/ProgramFiles(x86)/LLVM/vc11/bin/Debug\\\\\\lib\\clang\\3.4“-I”C:\\MinGW\\include\\sys“-I”C:\\MinGW\\lib\\gcc\\i686-pc-mingw32\\4.8.0\\include“-I”C:\\MinGW\\include“-I”C:\\MinGW\\include\\C++“-I”C:\\MinGW\\include\\C++\\C++\\include\\C++\\C++\\4.8.0“-I”C:\\MinGW\\include\\C++\\4.8.0\\C:\\MinGW\\include\\C++\\4.8.0\\debug“-I”C:\\MinGW\\include\\C++\\4.8.0\\decimal“-I”C:\\MinGW\\include\\C++\\C++\\4.8.0\\i686-pc-mingw32“-I”C:\\MinGW\\include\\C++\\4.8.0\\tr1“-I”C:\\MinGW\\include\\C++\\C++\\C++\\C++\\include\\C++\\C++\\C++\\C++\\C++\\C:\\C++\\C:\\C++\\C:\\C:\\C:\\C++\\C:\\C:\\C:\\C:\\C:\\C:\\MinGW\\“-STD= C++宏- FREST宏- FER限制19 - MSTACKReang-FMS扩展-FMSC版本=1300 FSTEM模板解析-fObcRunTime= GCC -FOBC++缺省综合属性-FCXX异常-FExcExp- fChutic显示选项-FCuor诊断-后端选项-矢量化循环-O简单.O-XC+Simul.CPP
clang-cc1 3.4版基于LLVM 3.4svn默认目标i686-pc-win32
#包括“…”搜索从这里开始:
#包括搜索从这里开始:
C:\MinGW\include\sys
C:\MinGW\lib\gcc\i686-pc-mingw32\4.8.0\include
C:\MinGW\include
C:\MinGW\include\C++
C:\MinGW\include\C++\4.8.0
C:\MinGW\include\C++\4.8.0\backward
C:\MinGW\include\C++\4.8.0\bits
C:\MinGW\include\C++\4.8.0\debug
C:\MinGW\include\C++\4.8.0\decimal
C:\MinGW\include\C++\4.8.0\ext
C:\MinGW\include\C++\4.8.0\i686-pc-mingw32
C:\MinGW\include\C++\4.8.0\tr1
C:\MinGW\include\C++\4.8.0\tr2
C:\MinGW\include\C++\4.8.0\profile
搜索列表结束。
在simple.cpp:3中包含的文件中:
在C:\MinGW\include\C++\4.8.0\map:61中包含的文件中:
在C:\MinGW\include\C++\4.8.0\bits/stl_map.h:63中包含的文件中:
在C:\MinGW\include\C++\4.8.0\tuple:39中包含的文件中:
在C:\MinGW\include\C++\4.8.0\array中包含的文件中:38:
在C:\MinGW\include\C++\4.8.0\stdexcept:39中包含的文件中:
在C:\MinGW\include\C++\4.8.0\string:40中包含的文件中:
在C:\MinGW\include\C++\4.8.0\bits/char\u traits.h:40中包含的文件中:
在C:\MinGW\include\C++\4.8.0\bits/postypes中包含的文件中。h:40:
C:\MinGW\include\C++\4.8.0\cwchar:143:11:错误:全局命名空间中没有名为“fgetws”的成员
使用::fgetws;
~~^
C:\MinGW\include\C++\4.8.0\cwchar:145:11:错误:全局命名空间中没有名为“fputws”的成员
使用::fputws;
~~^
C:\MinGW\include\C++\4.8.0\cwchar:149:11:错误:全局命名空间中没有名为“getwc”的成员
使用::getwc;
~~^
C:\MinGW\include\C++\4.8.0\cwchar:150:11:错误:全局命名空间中没有名为“getwchar”的成员
使用::getwchar;
~~^
C:\MinGW\include\C++\4.8.0\cwchar:155:11:错误:全局命名空间中没有名为“putwc”的成员
使用::putwc;
~~^
C:\MinGW\include\C++\4.8.0\cwchar:156:11:错误:全局命名空间中没有名为“putwchar”的成员
使用::putwchar;
~~^
生成6个错误。

感谢您的帮助

当定义
\uu MSVCRT\uu
宏时,这些函数在MinGW的
stdio.h
和/或
wchar.h
中声明。当MinGW编译器重新构建
MSVCRT.dll
运行时,它定义了
\uu MSVCRT\uuu
,而不是旧的
crtdll
运行时(我认为它几乎不再使用)

我不知道clang是否会定义该宏,或者在什么条件下会定义该宏(或者即使clang会链接到
msvcrt.dll

您可以尝试将
-D_umsvcrt\uu=1
添加到clang命令行中,以查看这是否能使事情正常进行