Error msb8041 для этого проекта требуются библиотеки mfc

Проблема со сборкой проекта MSB8041 и другие ошибки Visual C++ Решение и ответ на вопрос 2965352

Здраствуйте
попробовал собрать этот проект:

https://habr.com/ru/post/190800/
или
https://www.codeproject.com/Ar… s-debugger
что бы скачать по ссылке зачем то нужно потверждать гугл-аккаунт
если вам будет удобнее скачивать прикрепил те же файлы то же, что по ссылке
бинарники и сорцы три файла

ос win7 Visual Studio Community 2019 16.11.0
Сначала столкнулся с ошибкой сборки:

Код

Ошибка	MSB8041	для этого проекта требуются библиотеки MFC. Установите их с помощью установщика Visual Studio (вкладка "Отдельные компоненты") для всех используемых архитектур и наборов инструментов.	debbuger_win1	C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildMicrosoftVCv160Microsoft.CppBuild.targets	479

Через установщик VS (компоненты->MFC) никаких результатов, то есть я пробовал разные варианты и версии MFC и ATL но ошибка все та же.

Честно сказать не знаю что такое MFC и с VS интерфейсом как то все избыточно запутанно сложно, если, что то не работает. Посмотрел файлы проекта vsxproj попробовал создать свой пустой проект MFC (создать проект -> мастер класических приложений Windows -> консольное приложение.EXE + галочки MFC + предкомпилированный заголовок ) результат компилятор снова ругнулся и снова несколько ошибок с MSB8041 !

Код

Серьезность	Код	Описание	Проект	Файл	Строка	Состояние подавления
Ошибка	MSB8041	для этого проекта требуются библиотеки MFC. Установите их с помощью установщика Visual Studio (вкладка "Отдельные компоненты") для всех используемых архитектур и наборов инструментов.	debbuger_win1	C:DProgram Files (x86)Microsoft Visual Studio2019CommunityMSBuildMicrosoftVCv160Microsoft.CppBuild.targets	479	
Ошибка (активно)	E1696	не удается открыть источник файл "afx.h"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1framework.h	13	
Ошибка (активно)	E1696	не удается открыть источник файл "afxwin.h"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1framework.h	14	
Ошибка (активно)	E1696	не удается открыть источник файл "afxext.h"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1framework.h	15	
Ошибка (активно)	E1696	не удается открыть источник файл "afxdtctl.h"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1framework.h	17	
Ошибка (активно)	E1696	не удается открыть источник файл "afxcmn.h"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1framework.h	20	
Ошибка (активно)	E0020	идентификатор "CWinApp" не определен	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1debbuger_win1.cpp	15	
Ошибка (активно)	E0020	идентификатор "HMODULE" не определен	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1debbuger_win1.cpp	23	
Ошибка (активно)	E0282	глобальная область видимости не содержит "GetModuleHandle"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1debbuger_win1.cpp	23	
Ошибка (активно)	E0020	идентификатор "AfxWinInit" не определен	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1debbuger_win1.cpp	28	
Ошибка (активно)	E0282	глобальная область видимости не содержит "GetCommandLine"	debbuger_win1	C:something0DebuggerDebugger2debbuger_win1debbuger_win1debbuger_win1.cpp	28

Наверное MFC это что то вроде библиотеки для создания оконных приложений, в том числе для консольных приложений, но оно не работает, не устанавливается. Соотвественно цель скомпилировать Debugger, но как быть с этим MFC ? Что делать, есть какие то варианты ?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

I’ve installed MFC extension for VS 2019 version 16.7 on Windows x64 operating system using the following extensions:

  1. desktop application development with c++
  2. C++ v14.26 MFC for v142 build tools (x86 & x64)
  3. C++ v14.26 MFC for v142 build tools with Spectre Mitigations (x86 & x64)
  4. C++ ATL for the v142 build tools
  5. ATL and MFC for the v141 build tools

But when I open a new MFC project, and try to build it, even before editing, I get the following error:
MSB804: Severity Code Description Project File Line Suppression State Error MSB8041 MFC libraries are required for this project. Install them from the Visual Studio installer (Individual Components tab) for any toolsets and architectures being used. MFCApplication1 C:Program Files (x86)Microsoft Visual Studio2019CommunityMSBuildMicrosoftVCv160Microsoft.CppBuild.targets 451

I don’t know what libraries can be missing at this point, I thought I’ve installed every possible extension. perhaps someone has an idea what did I do wrong or what library am I missing?

Thank you very much.

asked Aug 20, 2020 at 6:50

user14092875's user avatar

user14092875user14092875

1451 gold badge1 silver badge12 bronze badges

2

Open Visual Studio Installer - > Modify - & gt; 
For a single component, select install:
    C++ATL for v142 (x86 and x64)
    C++MFC for v142 (x86 and x64)
    C++ v14.21 ATL for v142 (x86 and x64)
    C++v14.21 MFC for v142 (x86 and x64)

If the same error still occurs, install
    C++ATL for the latest v142 build tools
    C++ MFC for the latest v142 build tool

answered Apr 13, 2022 at 9:26

又是那条吊带裙's user avatar

    msm.ru

    Нравится ресурс?

    Помоги проекту!

    !
    Правила раздела Visual C++ / MFC / WTL (далее Раздела)

    >
    MFC и VS2019
    , установить

    • Подписаться на тему
    • Сообщить другу
    • Скачать/распечатать тему



    Сообщ.
    #1

    ,
    04.08.20, 17:38

      Senior Member

      ****

      Рейтинг (т): 23

      Есть у меня VS2019, и я решил скомпилировать в ней свой старый проект. Она сказала, что надо установить библиотеки MFC при помощи установщика Visual Studio Installer. В нём я выбрал строку «MFC C++ версии 14.20 для средств сборки версии 142 (x86 и x64)», но после этого студия опять требует библиотеки MFC. Чего ей не хватает?


      Black_Dragon



      Сообщ.
      #2

      ,
      06.08.20, 08:11

        Full Member

        ***

        Рейтинг (т): 5

        14.27
        Конфиг инсталятора.

        Прикреплённый файлПрикреплённый файл.vsconfig (3,26 Кбайт, скачиваний: 505)

        Сообщение отредактировано: Black_Dragon — 06.08.20, 08:32


        prografix



        Сообщ.
        #3

        ,
        06.08.20, 09:17

          Senior Member

          ****

          Рейтинг (т): 23

          Установил версию 14.26 и не помогло. Опять пишет, что для этого проекта требуются библиотеки MFC. Код ошибки MSB8041.

          Добавлено 06.08.20, 09:19
          А что делать с конфигом инсталятора?


          Black_Dragon



          Сообщ.
          #4

          ,
          10.08.20, 03:00

            Full Member

            ***

            Рейтинг (т): 5

            Цитата prografix @ 06.08.20, 09:17

            А что делать с конфигом инсталятора?

            В инсталяторе его импортировать и запустить установить.


            prografix



            Сообщ.
            #5

            ,
            11.08.20, 10:42

              Senior Member

              ****

              Рейтинг (т): 23

              Black_Dragon
              Спасибо, помогло. Теперь проект собирается.

              0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

              0 пользователей:

              • Предыдущая тема
              • Visual C++ / MFC / WTL
              • Следующая тема

              Рейтинг@Mail.ru

              [ Script execution time: 0,0229 ]   [ 17 queries used ]   [ Generated: 9.02.23, 14:40 GMT ]  

              title description ms.date ms.topic f1_keywords dev_langs author ms.author manager ms.technology ms.workload

              MSBuild error MSB8041

              MSBuild error MSB8041 occurs when MFC is required for a build, but the right version wasn’t found.

              03/31/2021

              error-reference

              MSB8041

              C++

              ghogen

              ghogen

              jmartens

              msbuild

              multiple

              MSBuild error MSB8041

              MSB8041: MFC/ATL Libraries are required for this project.

              This error occurs when MFC or ATL is required for a build, but it wasn’t found.

              Remarks

              MFC and ATL libraries aren’t installed by default when you install a C++ workload in Visual Studio. To fix the error, make sure the right versions of MFC and ATL libraries for your build toolset are installed. There are versions of MFC for each version of the C++ build tools, for each target platform, and with or without Spectre mitigations. For example, C++ MFC for latest v143 build tools (x86 and x64) has the x86 and x64 libraries without Spectre mitigations for the latest version of Visual Studio 2022 (v143). If you simply want to use the latest libraries for a given version of a Visual Studio toolset, you need C++ MFC for latest [version] build tools ([target]) for non-Spectre builds and C++ MFC for latest [version] build tools with Spectre Mitigations ([target]) for Spectre mitigated builds. Choose the correct option for your target platform architecture. The others are for cases where you’re specifically targeting an earlier toolset. For more information, see MFC Library Versions.

              To install the MFC and ATL libraries

              1. Open the Visual Studio Installer.
              2. Choose the Modify button next to the version of Visual Studio you use.
              3. Select the Individual components tab at the top of the dialog box.
              4. Enter MFC in the Search components box.
              5. Select the MFC components that match your project targets, such as x86 or ARM64EC. Select the components with Spectre mitigations if you build your projects with Spectre mitigations enabled.
                • In most cases, you want to select MFC for the latest build tools. Your organization or project may require a specific, earlier version of the toolset. Make sure the version, targets, and Spectre mitigations of the MFC components you install match the toolset version, targets, and Spectre mitigations required by the project you’re building.
              6. Enter ATL in the Search components box.
              7. Select the ATL components that match your project targets, such as x86 or ARM64EC. Select the components with Spectre mitigations if you build your projects with Spectre mitigations enabled.
                • In most cases, you want to select ATL for the latest build tools. Your organization or project may require a specific, earlier version of the toolset. Make sure the version, targets, and Spectre mitigations of the ATL components you install match the toolset version, targets, and Spectre mitigations required by the project you’re building.
              8. Choose Modify to install the selected components.

              For more information about modifying Visual Studio to install the libraries and binaries you need, see Modify Visual Studio.

              Advanced diagnostics

              For detailed build troubleshooting, this error is triggered in the C++ build process in the MSBuild target Microsoft.CppBuild.targets when the following file isn’t found: $(VCToolsInstallDir)atlmfclib$(_SpectreLibsDir)$(PlatformShortName)mfcs140.lib. The properties come from the environment ($(VCToolsInstallDir)) and the project configuration: $(_SpectreLibsDir) is empty or spectre, $(PlatformShortName) is x86, x64, arm, arm64, or arm64EC.

              title description ms.date ms.topic f1_keywords dev_langs author ms.author manager ms.technology ms.workload

              MSBuild error MSB8041

              MSBuild error MSB8041 occurs when MFC is required for a build, but the right version wasn’t found.

              03/31/2021

              error-reference

              MSB8041

              C++

              ghogen

              ghogen

              jmartens

              msbuild

              multiple

              MSBuild error MSB8041

              MSB8041: MFC/ATL Libraries are required for this project.

              This error occurs when MFC or ATL is required for a build, but it wasn’t found.

              Remarks

              MFC and ATL libraries aren’t installed by default when you install a C++ workload in Visual Studio. To fix the error, make sure the right versions of MFC and ATL libraries for your build toolset are installed. There are versions of MFC for each version of the C++ build tools, for each target platform, and with or without Spectre mitigations. For example, C++ MFC for latest v143 build tools (x86 and x64) has the x86 and x64 libraries without Spectre mitigations for the latest version of Visual Studio 2022 (v143). If you simply want to use the latest libraries for a given version of a Visual Studio toolset, you need C++ MFC for latest [version] build tools ([target]) for non-Spectre builds and C++ MFC for latest [version] build tools with Spectre Mitigations ([target]) for Spectre mitigated builds. Choose the correct option for your target platform architecture. The others are for cases where you’re specifically targeting an earlier toolset. For more information, see MFC Library Versions.

              To install the MFC and ATL libraries

              1. Open the Visual Studio Installer.
              2. Choose the Modify button next to the version of Visual Studio you use.
              3. Select the Individual components tab at the top of the dialog box.
              4. Enter MFC in the Search components box.
              5. Select the MFC components that match your project targets, such as x86 or ARM64EC. Select the components with Spectre mitigations if you build your projects with Spectre mitigations enabled.
                • In most cases, you want to select MFC for the latest build tools. Your organization or project may require a specific, earlier version of the toolset. Make sure the version, targets, and Spectre mitigations of the MFC components you install match the toolset version, targets, and Spectre mitigations required by the project you’re building.
              6. Enter ATL in the Search components box.
              7. Select the ATL components that match your project targets, such as x86 or ARM64EC. Select the components with Spectre mitigations if you build your projects with Spectre mitigations enabled.
                • In most cases, you want to select ATL for the latest build tools. Your organization or project may require a specific, earlier version of the toolset. Make sure the version, targets, and Spectre mitigations of the ATL components you install match the toolset version, targets, and Spectre mitigations required by the project you’re building.
              8. Choose Modify to install the selected components.

              For more information about modifying Visual Studio to install the libraries and binaries you need, see Modify Visual Studio.

              Advanced diagnostics

              For detailed build troubleshooting, this error is triggered in the C++ build process in the MSBuild target Microsoft.CppBuild.targets when the following file isn’t found: $(VCToolsInstallDir)atlmfclib$(_SpectreLibsDir)$(PlatformShortName)mfcs140.lib. The properties come from the environment ($(VCToolsInstallDir)) and the project configuration: $(_SpectreLibsDir) is empty or spectre, $(PlatformShortName) is x86, x64, arm, arm64, or arm64EC.

              Понравилась статья? Поделить с друзьями:
            • Error msb8020 the build tools for v143 platform toolset v143 cannot be found
            • Error msb8020 the build tools for v141 platform toolset v141 cannot be found
            • Error msb6003 c
            • Error msb4236 the sdk microsoft net sdk specified could not be found
            • Error msb4057 the target gettargetpath does not exist in the project