简体   繁体   English

带有MinGW STL的Clang(错误:全局名称空间中没有名为“ fgetws”的成员)

[英]Clang with MinGW STL (Error: no member named 'fgetws' in the global namespace)

I'm trying to compile a simple dll with Clang under windows using the MinGW STL (latest versions for clang and mingw). 我正在尝试使用MinGW STL(clang和mingw的最新版本)在Windows下用Clang编译一个简单的dll。 As you can see, I have disabled ms compatibility mode and the hardcoded VS headers. 如您所见,我已禁用ms兼容模式和硬编码的VS标头。 I get the following errors when I include the MinGW STL map header: 当包含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.

Any help is appreciated! 任何帮助表示赞赏!

Those functions are declared in MinGW's stdio.h and/or wchar.h when the __MSVCRT__ macro is defined. 当定义__MSVCRT__宏时,这些函数在MinGW的stdio.h和/或wchar.h中声明。 The MinGW compiler defines __MSVCRT__ when it's building agains the msvcrt.dll runtime instead of the older crtdll runtime (which I think is pretty much never used anymore). MinGW编译器在构建时会定义__MSVCRT__ ,从而__MSVCRT__运行msvcrt.dll运行时,而不是旧的crtdll运行时(我认为它几乎不再使用了)。

I don't know if clang would define that macro or under what conditions it would (or even if clang will link to msvcrt.dll ). 我不知道clang是否会定义该宏或在什么条件下会定义(甚至clang将链接到msvcrt.dll )。

You might try adding a -D__MSVCRT__=1 to the clang command line to see if that makes things work. 您可以尝试将-D__MSVCRT__=1添加到clang命令行中,以查看是否可以使工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 全局命名空间中没有名为“isinf”的成员 - no member named 'isinf' in the global namespace 错误:MacOS上的“全局名称空间中没有名为&#39;uint8_t&#39;的成员” - Error: “no member named 'uint8_t' in the global namespace” on MacOS C++:错误:全局命名空间中没有名为“signbit”的成员 - C++: error: no member named 'signbit' in the global namespace cstdint中的错误:全局命名空间中没有名为xxx的成员 - Errors in cstdint: No member named xxx in global namespace Xcode:cstdlib在全局命名空间中没有名为“xxx”的成员 - Xcode: cstdlib no member named “xxx” in the global namespace 卡特琳娜 C++:使用<cmath>标头产生错误:全局命名空间中没有名为“signbit”的成员</cmath> - Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespace 错误:名称空间“ std”中没有名为“ stod”的成员 - Error: no member named 'stod' in namespace 'std' std错误名称空间中没有名为“ bind”的成员 - No member named 'bind" in the namespace of std error 名称空间“ namespace”中没有名为“ name”的成员 - No member named 'name' in namespace 'namespace' 全局命名空间好友类无法访问命名命名空间类的私有成员 - Global namespace friend class cannot access private member of named namespace class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM