简体   繁体   English

通过mingw编译win32项目时缺少sal.h

[英]Missing sal.h while compling a win32 project via mingw

Error message: 错误信息:

fatal error: sal.h: No such file or directory cstudy line 11, external location: C:\\Program Files\\Microsoft SDKs\\Windows\\v7.0A\\Include\\specstrings.h C/C++ Problem. 致命错误:sal.h:没有这样的文件或目录cstudy第11行,外部位置:C:\\ Program Files \\ Microsoft SDKs \\ Windows \\ v7.0A \\ Include \\ specstrings.h C / C ++问题。

But when I add VC/include to this project,I received a ton of error messages. 但是当我将VC / include添加到这个项目时,我收到了大量的错误消息。 It seems VC/include/sal.h is not a standard header file for GCC. 似乎VC / include / sal.h不是GCC的标准头文件。

The source code is very simple: 源代码非常简单:

#include "windows.h"
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{

    return 0;
}

Environment: 环境:

  • Windows 7.0A SDK Windows 7.0A SDK
  • VC 2010 VC 2010
  • MINGW MINGW
  • CDT/ECLIPSE. CDT / ECLIPSE。

Thanks. 谢谢。

No, the sal.h header is not part of GCC / MinGW, however you can add your VC/include/ as an include directory to eclipse. 不, sal.h不是 GCC / MinGW的一部分,但是你可以将你的VC/include/作为include目录添加到eclipse中。

alternative: move all (!) requried headers to your mingw or project include directory. 替代方法:所有 (!)所需的标题移动到您的mingw或项目include目录。 The one from MinGw is: <mingw path>/include ). MinGw中的一个是: <mingw path>/include )。

Anyway. 无论如何。 sal.h, if you install the Windows SDK then it isn't going to be in the SDK directory, but you should find that if you select to install the compiler and tools it will get installed along with that. sal.h,如果你安装了Windows SDK,那么它不会出现在SDK目录中,但你会发现如果选择安装编译器和工具,它将随之安装。 This is because sal.h is needed in the CRT headers as well as the Windows headers. 这是因为CRT头文件和Windows头文件中都需要sal.h. So you NEED to install the VS compilers and tools along with the SDK. 所以你需要安装VS编译器和工具以及SDK。 You will then find that the compiler will be installed by default under %ProgramFiles%\\Microsoft Visual Studio 2010\\VC and sal.h will be in include under that path. 然后,您将发现默认情况下将在%ProgramFiles%\\ Microsoft Visual Studio 2010 \\ VC下安装编译器,并且sal.h将包含在该路径下。 On 64 bit systems it will be under %ProgramFiles(x86)% by default. 在64位系统上,默认情况下它将在%ProgramFiles(x86)%下。

source: http://social.msdn.microsoft.com/Forums/eu/windowssdk/thread/0e166050-99f1-436b-bd94-b39e2910f43d 来源: http//social.msdn.microsoft.com/Forums/eu/windowssdk/thread/0e166050-99f1-436b-bd94-b39e2910f43d

See: 看到:

I just ran into this problem. 我刚遇到这个问题。 I can't seem to get the sal.h header file through the MS Windows version of mingw, but "yum whatprovides \\*/sal.h" on my Fedora Core 18 machine brought up the mingw-headers package. 我似乎无法通过MS Windows版本的mingw获取sal.h头文件,但我的Fedora Core 18机器上的“yum whatprovides \\ * / sal.h”提出了mingw-headers包。 I downloaded the source package (ie yumdownloader --source mingw-headers), opened up the .tar.gz file in file-roller, grabbed the sal.h file, and put it in /c/MinGW/include on my MS Windows machine. 我下载了源包(即yumdownloader --source mingw-headers),在file-roller中打开了.tar.gz文件,抓住了sal.h文件,并将它放在我的MS Windows上的/ c / MinGW / include中机。

The same package had dsound.h, which was the next missing header file. 同一个包有dsound.h,这是下一个丢失的头文件。

I've never tried to use mingw under Fedora Core to cross-compile MS Windows apps, but maybe it's time... :-) 我从来没有试过在Fedora Core下使用mingw来交叉编译MS Windows应用程序,但也许是时候...... :-)

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

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