简体   繁体   中英

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.

But when I add VC/include to this project,I received a ton of error messages. It seems VC/include/sal.h is not a standard header file for 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
  • VC 2010
  • MINGW
  • 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.

alternative: move all (!) requried headers to your mingw or project include directory. The one from MinGw is: <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. This is because sal.h is needed in the CRT headers as well as the Windows headers. So you NEED to install the VS compilers and tools along with the 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. On 64 bit systems it will be under %ProgramFiles(x86)% by default.

source: 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. 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.

The same package had dsound.h, which was the next missing header file.

I've never tried to use mingw under Fedora Core to cross-compile MS Windows apps, but maybe it's time... :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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