当试图编译一个.dll,我得到一个错误interface关键字 [英] When trying to compile a .dll, I'm getting an error with the interface keyword

查看:232
本文介绍了当试图编译一个.dll,我得到一个错误interface关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio中设置了一个项目来创建一个.dll。我在项目中包含一个使用关键字interface的外部库。这给我以下错误:

I have set up a project in Visual Studio to create a .dll. I have included an external library in the project which uses the keyword "interface". This is giving me the following error:


错误C2146:语法错误:在标识符'INuiAudioBeam'之前缺少';' b $ b

error C2146: syntax error : missing ';' before identifier 'INuiAudioBeam'

这些是发生错误的代码行:

These are the lines of code where the error occurs:

#ifndef __INuiAudioBeam_FWD_DEFINED__
#define __INuiAudioBeam_FWD_DEFINED__
typedef interface INuiAudioBeam INuiAudioBeam; //Error on this line
#endif

上述代码是头文件的一部分在外部库中我已经包括。该项目在编译时没有任何错误,没有包含库的头文件,但没有任何错误(注意:链接库不会导致任何问题)。

The above code is part of a header file in the external library I have included. The project builds successfully without any errors when compiling without including the headers for the library (Note: Linking the library does not cause any problems).

?是因为我有一个外部库我用来创建我的DLL?

What is the solution to this? Is it because I have an external library I'm using to create my dll? Should I create a .lib instead of a dll?

推荐答案

如果任何人搜索这个问题,很可能是

If anyone else searches this, the problem is most likely

#define WIN32_LEAN_AND_MEAN

之前

#include <windows.h>

删除define,确保包括windows.h,并且应该定义interface关键字

Remove the define, make sure your including windows.h, and that should define interface keyword for you

这篇关于当试图编译一个.dll,我得到一个错误interface关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆