D8048:无法编译C文件'的OpenSSL \ applink.c'与/ ZW选项选项、文件、ZW、applink

2023-09-03 12:35:54 作者:一世殇

我想使用OpenSSL在我的Metro应用。我创建了一个C ++ WinRTComponent这部分下有OpenSSL的文件

I am trying to use OpenSSL in my metro application. I created a C++ WinRTComponent and have openssl files under this component

然而,当我尝试编译项目,我得到了以下错误:      D8048:无法编译C文件'的OpenSSL \ applink.c'与/ ZW选项

However, when I try to compile the project, I got the following error: D8048: cannot compile C file 'openssl\applink.c' with /ZW option

任何人都可以告诉我,我应该怎么解决这个问题,让我的项目编译?

Anyone can tell me how should I resolve this problem to get my project to compile?

请让我知道如果你需要任何其他信息来帮助我。

Please let me know if you need any other info to help me.

谢谢

推荐答案

该错误消息正是它说,这是 - VC ++不支持C ++ / CX扩展 - 与/ ZW编译器开关激活 - 在编译为C文件(这还挺有道理的,因为这些扩展是面向对象的)。

The error message is exactly what it says it is - VC++ does not support C++/CX extensions - enabled with /ZW compiler switch - in files compiled as C (which kinda makes sense, since those extensions are object-oriented).

为什么你会看到这样做的原因是,默认情况下,在地铁C ++项目中的所有文件都与/ ZW编译。不幸的是,这也适用于.c文件,即使它实际上不为他们工作。你需要的是有选择地禁用扩展名的文件。 >上的文件或者在Solution Explorer中选择文件的属性 - 您可以通过右键单击做到这一点。在属性页对话框,定位到C / C ++ - >常规,寻找启用Windows运行时扩展

The reason why you're seeing this is that, by default, all files in a Metro C++ project are compiled with /ZW. Unfortunately, this also applies to .c files, even though it doesn't actually work for them. What you need is to disable the extensions selectively for those files. You can do so via right-click -> Properties on a file or a selection of files in Solution Explorer. In the Property Pages dialog, navigate to C/C++ -> General, and look for "Enable Windows Run Time Extensions".