w32 icon indicating copy to clipboard operation
w32 copied to clipboard

Unable to build w32

Open drako0812 opened this issue 12 years ago • 4 comments

Development Environment Info

Windows 8 64-bit MinGW 32-bit gcc 4.8.1 go version go1.2 windows/386

Sample of Error Output

c:\mingw\include\ole2.h:70:52: error: unknown type name 'LPOLESTR' WINOLEAPI ReadFmtUserTypeStg(LPSTORAGE,CLIPFORMAT_,LPOLESTR_); ^ In file included from c:\mingw\include\rpcdce.h:33:0, from c:\mingw\include\rpc.h:65, from c:\mingw\include\windows.h:82, from c:\mingw\include\rpc.h:27, from c:\mingw\include\wtypes.h:29, from src\github.com\AllenDang\w32\user32.go:8: c:\mingw\include\ole2.h:80:41: error: expected ')' before 'const' WINOLEAPI OleCreateLinkToFile(LPCOLESTR,REFIID,DWORD,LPFORMATETC,LPOLECLIENTSITE,LPSTORAGE,PVOID_); ^ In file included from c:\mingw\include\windows.h:101:0, from c:\mingw\include\rpc.h:27, from c:\mingw\include\wtypes.h:29, from src\github.com\AllenDang\w32\user32.go:8: c:\mingw\include\ole2.h:81:38: error: unknown type name 'LPCOLESTR' WINOLEAPI OleCreateFromFile(REFCLSID,LPCOLESTR,REFIID,DWORD,LPFORMATETC,LPOLECLIENTSITE,LPSTORAGE,PVOID_); ^ c:\mingw\include\ole2.h:109:47: error: expected ')' before 'BOOL' WINOLEAPI_(HGLOBAL) OleGetIconOfFile(LPOLESTR,BOOL); ^ c:\mingw\include\ole2.h:110:48: error: unknown type name 'LPOLESTR' WINOLEAPI_(HGLOBAL) OleGetIconOfClass(REFCLSID,LPOLESTR,BOOL); ^ c:\mingw\include\ole2.h:111:59: error: unknown type name 'LPOLESTR' WINOLEAPI_(HGLOBAL) OleMetafilePictFromIconAndLabel(HICON,LPOLESTR,LPOLESTR,UINT); ^ c:\mingw\include\ole2.h:111:68: error: unknown type name 'LPOLESTR' WINOLEAPI_(HGLOBAL) OleMetafilePictFromIconAndLabel(HICON,LPOLESTR,LPOLESTR,UINT); ^ c:\mingw\include\ole2.h:112:44: error: unknown type name 'LPOLESTR' WINOLEAPI OleRegGetUserType(REFCLSID,DWORD,LPOLESTR_); ^ In file included from src\github.com\AllenDang\w32\user32.go:8:0: c:\mingw\include\wtypes.h:110:18: error: 'BSTR' redeclared as different kind of symbol typedef OLECHAR *BSTR; ^ In file included from c:\mingw\include\rpcdce.h:33:0, from c:\mingw\include\rpc.h:65, from c:\mingw\include\windows.h:82, from c:\mingw\include\rpc.h:27, from c:\mingw\include\wtypes.h:29, from src\github.com\AllenDang\w32\user32.go:8: c:\mingw\include\oleauto.h:231:1: note: previous declaration of 'BSTR' was here WINOLEAUTAPI_(BSTR) SysAllocStringByteLen(const char_,unsigned int); ^

Other Info

The above is only the bottom several lines of the error output, the actual output is over a thousand lines of similar errors. I'm not sure why these errors are occurring, as far as I know there is nothing wrong with my MinGW installation. This issue may still be on my side. If so, any help would be greatly appreciated.

drako0812 avatar Jan 13 '14 13:01 drako0812

@olekukonko I do not see how this could possibly be related to my issue.

From what I have looked at a big part of my issue must be related to the preprocessor. But how to fix it, or if it's fixable, is beyond my knowledge.

drako0812 avatar Jan 16 '14 19:01 drako0812

@drako0812 its a bit related ... am still doing some investigation on the issue, but this is the more reason why Terminal progress bar for Go should not depend on it for such a simple task ... so many other things not relating to screen size can make it fail

olekukonko avatar Jan 16 '14 20:01 olekukonko

I managed to hack user32.go in a way that allowed w32 to build on my system.

The original was:

import (
  // #include <wtypes.h>
  // #include <winable.h>
  "C"
  "fmt"
  "syscall"
  "unsafe"
)

The modified version:

import (
  // #include <windows.h>
  "C"
  "fmt"
  "syscall"
  "unsafe"
)

I'm not entirely sure why this worked except that some sort of preprocessor defines were affected.

drako0812 avatar Mar 14 '14 11:03 drako0812

If you using windows 64-bit then you need download go for amd64 architecture.

biorhitm avatar Jun 01 '14 04:06 biorhitm