简体   繁体   English

MinGW Windows.h无法编译

[英]MinGW Windows.h does not compile

I'm using MinGW g++ 4.6.2 on 64 bit Windows 7. As for IDE, I use Eclipse CDT. 我在64位Windows 7上使用MinGW g ++ 4.6.2。对于IDE,我使用Eclipse CDT。

I have a problem with my project - when I include "Windows.h" file, I'm getting thousands of errors. 我的项目有问题 - 当我包含“Windows.h”文件时,我收到了数以千计的错误。 I tried to create a diffrent file with only Windows.h included but it gives same errors. 我尝试创建一个只包含Windows.h的diffrent文件但它给出了相同的错误。

.h: 。H:

/*
 * WinWrapper.h
 *
 *  Created on: Feb 24, 2013
 *      Author: martin
 */

#ifndef WINWRAPPER_H_
#define WINWRAPPER_H_

char* winGetMainModule();

#endif /* WINWRAPPER_H_ */

.cpp: 的.cpp:

#include "WinWrapper.h"

#include <windows.h>

char* winGetMainModule() {



    return nullptr;

}

no other files include "WinWrapper.h" nor Windows.h. 没有其他文件包含“WinWrapper.h”和Windows.h。

template with C linkage GameProj        line 172, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\locale_classes.tcc C/C++ Problem
template with C linkage GameProj        line 228, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\locale_classes.tcc C/C++ Problem
template with C linkage GameProj        line 128, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\locale_classes.tcc C/C++ Problem
template with C linkage GameProj        line 133, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\locale_classes.tcc C/C++ Problem
confused by earlier errors, bailing out GameProj        line 118, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\ios_base.h C/C++ Problem
declaration of C function 'constexpr std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)' conflicts with  GameProj        line 117, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\ios_base.h C/C++ Problem
previous declaration 'constexpr std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)' here GameProj        line 77, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\bits\ios_base.h  C/C++ Problem
template with C linkage GameProj        line 614, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 623, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 629, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 636, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 592, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 598, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem
template with C linkage GameProj        line 602, external location: c:\mingw\lib\gcc\mingw32\4.6.2\include\c++\type_traits C/C++ Problem

... + around 200 KB of other error logs ... +大约200 KB的其他错误日志

Other project info: 其他项目信息:

  1. using libraries SDL, SDL_Image 使用库SDL,SDL_Image
  2. defined TARGET_WINX86 定义了TARGET_WINX86
  3. compiler flags -c -fmessage-length=0 -std=c++0x 编译器标志-c -fmessage-length = 0 -std = c ++ 0x

No idea whats going on. 不知道发生了什么事。 Please help, thanks in advance :)) 请帮忙,在此先感谢:))

from C:\\workspace\\GameProj\\src\\Base/string.h 来自C:\\ workspace \\ GameProj \\ src \\ Base / string.h

↑ culprit. ↑罪魁祸首。

you have your own string.h file which, due to the include paths, is being picked up by an include from winnt.h . 你有自己的string.h文件,由于包含路径,它被winnt.h的include包含。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM