V: mingw64 can not compile on win7

Created on 29 Jun 2019  路  7Comments  路  Source: vlang/v

I am following your instruction in README.md, and try to compile on windows 7

$ gcc -std=gnu11 -w -o v.exe v.c  # Build it with
v.c: In function 'os__getexepath':
v.c:3601:22: error: invalid type argument of unary '*' (have 'DWORD {aka long unsigned int}')
   return tos(result, *GetModuleFileName(0, result, os__MAX_PATH));
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and

$ gcc --version
gcc.exe (Rev1, Built by MSYS2 project) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Bug

Most helpful comment

Modify v.c as follows, and you can compile it manually gcc -std=gnu11 -w -o v.exe v.c

from

return tos(result, *GetModuleFileName(0, result, os__MAX_PATH));

to

return tos(result, GetModuleFileName(0, result, os__MAX_PATH));

All 7 comments

btw this is the only line which forbide v.c to be compiled on windows in mingw64. An improvement. thanks

Windows 10 too, my gcc v8.1.0, error massage is the same.

Modify v.c as follows, and you can compile it manually gcc -std=gnu11 -w -o v.exe v.c

from

return tos(result, *GetModuleFileName(0, result, os__MAX_PATH));

to

return tos(result, GetModuleFileName(0, result, os__MAX_PATH));

if we use os.getexepath() in V code, the following

return  tos ( result ,* GetModuleFileName ( 0 ,  result ,  os__MAX_PATH ) ) ;

will be generated.

PR #776 fixes the same but v.c needs to be updated too

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lobotony picture lobotony  路  3Comments

cjmxp picture cjmxp  路  3Comments

elimisteve picture elimisteve  路  3Comments

ArcDrake picture ArcDrake  路  3Comments

jtkirkpatrick picture jtkirkpatrick  路  3Comments