Fatal error: “No Target Architecture” in Visual Studio

前端 未结 11 2179
慢半拍i
慢半拍i 2020-11-29 05:52

When I try to compile my c++ project using Visual Studio 2010 in either Win32 or x64 mode I get the following error:

>C:\\Program Files (x86)\\Microsoft SDK

相关标签:
11条回答
  • 2020-11-29 06:16

    It would seem that _AMD64_ is not defined, since I can't imagine you are compiling for Itanium (_IA64_).

    0 讨论(0)
  • 2020-11-29 06:19

    If you are building 32bit then make sure you don't have _WIN64 defined for your project.

    0 讨论(0)
  • 2020-11-29 06:21

    Another cause of this can be including a header that depends on windows.h, before including windows.h.

    In my case I included xinput.h before windows.h and got this error. Swapping the order solved the problem.

    0 讨论(0)
  • 2020-11-29 06:23

    Besides causes described already, I received this error because I'd include:

    #include <fileapi.h>
    

    Apparently it was not needed (despite of CreateDirectoryW call). After commenting out, compiler was happy. Very strange.

    0 讨论(0)
  • 2020-11-29 06:26

    Use #include <windows.h> instead of #include <windef.h>.

    From the windows.h wikipedia page:

    There are a number of child header files that are automatically included with windows.h. Many of these files cannot simply be included by themselves (they are not self-contained), because of dependencies.

    windef.h is one of the files automatically included with windows.h.

    0 讨论(0)
提交回复
热议问题