Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build on Windows ? #5

Open
Zensey opened this issue Jul 18, 2017 · 2 comments
Open

How to build on Windows ? #5

Zensey opened this issue Jul 18, 2017 · 2 comments

Comments

@Zensey
Copy link

Zensey commented Jul 18, 2017

When trying to build project on windows I get th following error:

# github.com/facchinm/go-serial-native
src\github.com\facchinm\go-serial-native\windows.c: In function 'wc_to_utf8':
src\github.com\facchinm\go-serial-native\windows.c:52:43: error: 'WC_NO_BEST_FIT_CHARS' undeclared (first use in this function)
  if (!(size = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wc_str, -1,
                                           ^
src\github.com\facchinm\go-serial-native\windows.c:52:43: note: each undeclared identifier is reported only once for each function it appears in
src\github.com\facchinm\go-serial-native\windows.c: In function 'enumerate_hub_ports':
src\github.com\facchinm\go-serial-native\windows.c:169:3: error: unknown type name 'PUSB_NODE_CONNECTION_INFORMATION_EX'
   PUSB_NODE_CONNECTION_INFORMATION_EX connection_info_ex;
   ^
src\github.com\facchinm\go-serial-native\windows.c:170:23: error: invalid type argument of unary '*' (have 'int')
   ULONG size = sizeof(*connection_info_ex) + 30*sizeof(USB_PIPE_INFO);
                       ^
src\github.com\facchinm\go-serial-native\windows.c:172:28: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
   if (!(connection_info_ex = malloc(size)))
                            ^
src\github.com\facchinm\go-serial-native\windows.c:175:21: error: invalid type argument of '->' (have 'int')
   connection_info_ex->ConnectionIndex = index;
                     ^
src\github.com\facchinm\go-serial-native\windows.c:177:24: error: 'IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX' undeclared (first use in this function)
                        IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX,
                        ^
src\github.com\facchinm\go-serial-native\windows.c:178:24: warning: passing argument 3 of 'DeviceIoControl' makes pointer from integer without a cast [-Wint-conversion]
                        connection_info_ex, size,
                        ^
In file included from c:/TDM-GCC-32/include/windows.h:50:0,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/winbase.h:1456:24: note: expected 'PVOID {aka void *}' but argument is of type 'int'
 WINBASEAPI BOOL WINAPI DeviceIoControl(HANDLE,DWORD,PVOID,DWORD,PVOID,DWORD,PDWORD,POVERLAPPED);
                        ^
src\github.com\facchinm\go-serial-native\windows.c:179:24: warning: passing argument 5 of 'DeviceIoControl' makes pointer from integer without a cast [-Wint-conversion]
                        connection_info_ex, size, &size, NULL)) {
                        ^
In file included from c:/TDM-GCC-32/include/windows.h:50:0,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/winbase.h:1456:24: note: expected 'PVOID {aka void *}' but argument is of type 'int'
 WINBASEAPI BOOL WINAPI DeviceIoControl(HANDLE,DWORD,PVOID,DWORD,PVOID,DWORD,PDWORD,POVERLAPPED);
                        ^
src\github.com\facchinm\go-serial-native\windows.c:186:10: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
     free(connection_info_ex);
          ^
In file included from c:/TDM-GCC-32/include/objbase.h:12:0,
                 from c:/TDM-GCC-32/include/ole2.h:9,
                 from c:/TDM-GCC-32/include/windows.h:114,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/stdlib.h:358:38: note: expected 'void *' but argument is of type 'int'
 _CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:195:10: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
     free(connection_info_ex);
          ^
In file included from c:/TDM-GCC-32/include/objbase.h:12:0,
                 from c:/TDM-GCC-32/include/ole2.h:9,
                 from c:/TDM-GCC-32/include/windows.h:114,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/stdlib.h:358:38: note: expected 'void *' but argument is of type 'int'
 _CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:199:22: error: invalid type argument of '->' (have 'int')
    connection_info_ex->ConnectionIndex = connection_info->ConnectionIndex;
                      ^
src\github.com\facchinm\go-serial-native\windows.c:200:22: error: invalid type argument of '->' (have 'int')
    connection_info_ex->DeviceDescriptor = connection_info->DeviceDescriptor;
                      ^
src\github.com\facchinm\go-serial-native\windows.c:201:22: error: invalid type argument of '->' (have 'int')
    connection_info_ex->DeviceIsHub = connection_info->DeviceIsHub;
                      ^
src\github.com\facchinm\go-serial-native\windows.c:202:22: error: invalid type argument of '->' (have 'int')
    connection_info_ex->DeviceAddress = connection_info->DeviceAddress;
                      ^
src\github.com\facchinm\go-serial-native\windows.c:206:25: error: invalid type argument of '->' (have 'int')
   if (connection_info_ex->DeviceIsHub) {
                         ^
src\github.com\facchinm\go-serial-native\windows.c:211:45: error: invalid type argument of '->' (have 'int')
              parent_path, connection_info_ex->ConnectionIndex);
                                             ^
src\github.com\facchinm\go-serial-native\windows.c:214:9: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
    free(connection_info_ex);
         ^
In file included from c:/TDM-GCC-32/include/objbase.h:12:0,
                 from c:/TDM-GCC-32/include/ole2.h:9,
                 from c:/TDM-GCC-32/include/windows.h:114,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/stdlib.h:358:38: note: expected 'void *' but argument is of type 'int'
 _CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:217:44: error: invalid type argument of '->' (have 'int')
             parent_path, connection_info_ex->ConnectionIndex);
                                            ^
src\github.com\facchinm\go-serial-native\windows.c:221:10: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
     free(connection_info_ex);
          ^
In file included from c:/TDM-GCC-32/include/objbase.h:12:0,
                 from c:/TDM-GCC-32/include/ole2.h:9,
                 from c:/TDM-GCC-32/include/windows.h:114,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/stdlib.h:358:38: note: expected 'void *' but argument is of type 'int'
 _CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:226:42: error: invalid type argument of '->' (have 'int')
    port->usb_address = connection_info_ex->DeviceAddress + 1;
                                          ^
src\github.com\facchinm\go-serial-native\windows.c:227:38: error: invalid type argument of '->' (have 'int')
    port->usb_vid = connection_info_ex->DeviceDescriptor.idVendor;
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:228:38: error: invalid type argument of '->' (have 'int')
    port->usb_pid = connection_info_ex->DeviceDescriptor.idProduct;
                                      ^
src\github.com\facchinm\go-serial-native\windows.c:230:26: error: invalid type argument of '->' (have 'int')
    if (connection_info_ex->DeviceDescriptor.iManufacturer)
                          ^
src\github.com\facchinm\go-serial-native\windows.c:232:34: error: invalid type argument of '->' (have 'int')
                connection_info_ex->DeviceDescriptor.iManufacturer);
                                  ^
src\github.com\facchinm\go-serial-native\windows.c:233:26: error: invalid type argument of '->' (have 'int')
    if (connection_info_ex->DeviceDescriptor.iProduct)
                          ^
src\github.com\facchinm\go-serial-native\windows.c:235:34: error: invalid type argument of '->' (have 'int')
                connection_info_ex->DeviceDescriptor.iProduct);
                                  ^
src\github.com\facchinm\go-serial-native\windows.c:236:26: error: invalid type argument of '->' (have 'int')
    if (connection_info_ex->DeviceDescriptor.iSerialNumber) {
                          ^
src\github.com\facchinm\go-serial-native\windows.c:238:34: error: invalid type argument of '->' (have 'int')
                connection_info_ex->DeviceDescriptor.iSerialNumber);
                                  ^
src\github.com\facchinm\go-serial-native\windows.c:249:9: warning: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
    free(connection_info_ex);
         ^
In file included from c:/TDM-GCC-32/include/objbase.h:12:0,
                 from c:/TDM-GCC-32/include/ole2.h:9,
                 from c:/TDM-GCC-32/include/windows.h:114,
                 from src\github.com\facchinm\go-serial-native\libserialport.h:89,
                 from src\github.com\facchinm\go-serial-native\windows.c:23:
c:/TDM-GCC-32/include/stdlib.h:358:38: note: expected 'void *' but argument is of type 'int'
 _CRTIMP void __cdecl __MINGW_NOTHROW free (void*);
                                      ^
src\github.com\facchinm\go-serial-native\windows.c: In function 'get_port_details':
src\github.com\facchinm\go-serial-native\windows.c:409:16: warning: implicit declaration of function 'CM_Get_DevNode_Registry_PropertyA' [-Wimplicit-function-declaration]
          (cr = CM_Get_DevNode_Registry_PropertyA(dev_inst,
                ^
src\github.com\facchinm\go-serial-native\windows.c:410:20: error: 'CM_DRP_CLASS' undeclared (first use in this function)
                    CM_DRP_CLASS, 0, class, &size, 0)) != CR_SUCCESS) { }
                    ^
src\github.com\facchinm\go-serial-native\windows.c:420:13: error: 'CM_DRP_FRIENDLYNAME' undeclared (first use in this function)
             CM_DRP_FRIENDLYNAME, 0, description, &size, 0)) != CR_SUCCESS
             ^
src\github.com\facchinm\go-serial-native\windows.c:445:43: error: 'CM_DRP_COMPATIBLEIDS' undeclared (first use in this function)
                                           CM_DRP_COMPATIBLEIDS, 0,
                                           ^
src\github.com\facchinm\go-serial-native\windows.c:464:53: error: 'CM_DRP_ADDRESS' undeclared (first use in this function)
     if (CM_Get_DevNode_Registry_PropertyA(dev_inst, CM_DRP_ADDRESS,
                                                     ^
make: *** [esp.rubetek.exe] Error 2
@Zensey
Copy link
Author

Zensey commented Jul 18, 2017

Which compiler / toolcahin I should use ?

@Zensey
Copy link
Author

Zensey commented Jul 18, 2017

Switched to mingw-w64 (GCC for Windows 64 & 32 bits) and built succesfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant