No target architecture error


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

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


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

One thought on “No target architecture error

  1. Thanks! This was my problem. I was using #include <profileapi.h> for QueryPerformanceFrequency and QueryPerformanceCounter.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.