简体   繁体   English

我如何获得sal.h

[英]How do I get sal.h

I have been trying to compile a program with minw32, on win7. 我一直试图在win7上用minw32编译一个程序。 Every time I try to compile this, I get an error about sal.h missing. 每次我尝试编译时,都会收到有关sal.h缺失的错误。 I have downloaded both Visual Studio c++ 2010 (Express) and have gotten the Microsoft Win7 SDK. 我已经下载了Visual Studio c ++ 2010(Express)并获得了Microsoft Win7 SDK。 Even after all this, I still haven't found that header file. 即使在这之后,我仍然没有找到头文件。 Is there any place I could download it from? 有没有我可以下载的地方?

It's located in 它位于

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" (VS 2008)

or 要么

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" (VS 2010)

or 要么

"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include" (VS 2012)

of course, you may want to adapt to your local setup paths. 当然,您可能希望适应本地设置路径。

As the previous answer says, SAL is a Visual Studio thing. 正如之前的回答所说,SAL是一个Visual Studio的东西。 IMHO it's a great technology which helps the compiler understand the code so it can emit warnings when you do something wrong. 恕我直言,这是一项伟大的技术,可以帮助编译器理解代码,以便在您做错时可以发出警告。 Unfortunately, Microsoft seems to own a patent on it so other compilers can't implement it ☹. 不幸的是,微软似乎拥有一项专利,因此其他编译器无法实现它 ☹。 Even if you grab a copy of sal.h from your VS install I sincerely doubt it will work with mingw since it will translate the macros into attributes gcc/mingw doesn't understand. 即使你从VS安装中获取了sal.h的副本,我真诚地怀疑它是否可以与mingw一起使用,因为它会将宏转换为gcc / mingw不理解的属性。

I put together a small project called Salieri a while back which is basically a portable version of the SAL header that just defines away the SAL macros. 我把一个名为Salieri的小项目放在一起,这基本上是SAL头的可移植版本,它只是定义了SAL宏。 You won't get any of the benefits of SAL annotated code, but it should help you get code which uses SAL to compile on other compilers. 您将无法获得SAL注释代码的任何好处,但它应该可以帮助您获得使用SAL在其他编译器上编译的代码。

Sorry to promote my own project here, but I think it could be useful for a lot of people coming across this post. 很抱歉在这里宣传我自己的项目,但我认为这对很多人来说都很有用。

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

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