I encountered “winnt.h No target architecture” error though I included windows.h up to first.


I encountered “winnt.h No target architecture” error though I included windows.h up to first.

Recently i get obsessed with developing program with cgo. My first purpose is to make program to communicate with MTP device on windows such as Android Device.

I tried to just include some essential header files and build. Here are what I got.

codes:

// #cgo windows CFLAGS: -I"E:/WindowsSDK/Include/10.0.15063.0/um" -I"E:/WindowsSDK/Include/10.0.15063.0/shared" // // #include <windows.h> // // void test() { // // } import "C" 

outputs:

In file included from E:/WindowsSDK/Include/10.0.15063.0/shared/minwindef.h:182:0, from E:/WindowsSDK/Include/10.0.15063.0/shared/windef.h:24, from E:/WindowsSDK/Include/10.0.15063.0/um/windows.h:168, from .\main.go:5: E:/WindowsSDK/Include/10.0.15063.0/um/winnt.h:154:2: error: #error "No Target Architecture" #error "No Target Architecture" ^~~~~ 

Most of answers I found were "put #include <windows.h> up to first". How can I get rid of this error?

Submitted August 04, 2017 at 10:36PM by rlj1202
via reddit http://ift.tt/2ffy2BQ