LoginSignup
14
13

More than 5 years have passed since last update.

「warning LNK4075: /EDITANDCONTINUE は /SAFESEH の指定によって無視されます」の本当の対処法

Last updated at Posted at 2017-02-02

結論:UseDebugLibraries 属性が不足している

プロジェクトをアップグレードすると vcxproj ファイルに本来記述されるべき UseDebugLibraries 属性が記述されないため、vcxproj ファイルをテキストエディタで開いて記述を追加する。

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>StaticLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v120</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

解説

warning LNK4075: /EDITANDCONTINUE は /SAFESEH の指定によって無視されます。

これは古い Visual C++ プロジェクトを、新しいバージョンにアップグレードした際によく見られる警告です。

どうやら Visual C++ のアップグレード処理には不具合があるようです。新規プロジェクトではプロジェクトファイルに UseDebugLibraries 属性が適切に記述されますが、アップグレードしたプロジェクトでは省略されてしまいます。

UseDebugLibraries 属性が明記されていないと、Debug ビルドの設定と Release ビルドのデフォルト設定が混在してしまい、結果として警告が表示されます。

この背景を正しく理解するのはなかなか困難なので、どちらかのオプションを無効にする解決策を示すサイトがとても多いのですが、本当はプロジェクト設定全体に影響がある恐ろしい問題です。多分これが一番正しい対処法と思います。

参考

14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13