Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

No target architecture error

📅 2014-Aug-08 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

After adding a function call defined in fileapi.h, I got this error on compiling the code:

fatal error C1189: #error :  "No Target Architecture"

Solution

It turns out that on Windows one is not supposed to directly include the header file where the function is defined. Many of these functions require you to include a different file, usually indicated so in their MSDN documentation.

In my case, fileapi.h is not supposed to be included directly. Instead, the common windows.h should be used said the MSDN documentation. The error went away once I did that.

Tried with: Visual Studio 2013 and Windows 7 x64