Help us understand the problem. What is going on with this article?

#importディレクティブでCOMライブラリを使用した際、エラー:E0102が発生する場合の解消方法

More than 1 year has passed since last update.

Visual Studio 2017/2019で新しいプロジェクトを作成し、下記のように#importディレクティブでCOMライブラリを使用した際、intellisenseで

E0102 列挙型の事前宣言は非標準です

というエラーが発生します。ビルドではエラーが起きません。

#include <iostream>

#import <shdocvw.dll> auto_rename

int main()
{
    CoInitialize(nullptr);
}

解消方法

Visual Studio 2017/2019で新しいプロジェクトを作成すると、デフォルトでプロジェクトのプロパティで
[言語] > [準拠モード]が「はい(/permissive-)」になっています。
「いいえ」に変更すると、エラー:E0102は発生しなくなります。

kenichiuda
特にありません
https://github.com/udaken
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした