V: V语言中文网

Created on 23 Jun 2019  ·  17Comments  ·  Source: vlang/v

QQ群和微信群:

  • V语言QQ群:878358520
  • V语言微信群请关注“光谷码农”微信公众号,然后从底部菜单进群。

欢迎关注!

Documentation

Most helpful comment

the latest version of v.c canbuild with mingw with replace the getline with fgets

D:\>v_x86_64
V 0.1.0
Use Ctrl-D to exit
For now you have to use println() to print values, this will be fixed soon
>>> println('hell, world!')  <--- hang and abort

All 17 comments

在哪可以发帖求助

编译不成功

> $ ./vc -o v .                                                                                                     [±master ✓]
[1]    11498 segmentation fault  ./vc -o v .

请问有没有在Windows下,通过mingw编译成功的案例啊?

macOS编译没有问题,其它平台没有测试过

linux下通过了,主要是把code放到其他目录了

欢迎加入Vlang中文QQ群:550177672

windows下,在WSL中可以顺利编译成功。

https://gist.github.com/SongTianZuo/de6b978893ca45ad63e2c31bace03235

//windows下各种改,成功了v.exe,但不能编译语言v的程式。

gcc -w -m32 -Dwindows -o v.exe v.c
gcc -w -Dwindows -o v_x86_64.exe v.c

//增加windows头,因为原原本本本的代码用了一个win32api这里都加上过

ifdef windows

include

endif

//增加 exeinfo.h 的条件

ifdef _linux_

include

endif

backtrace 和 backtrace_symbols_fd 同样给加上 #ifdef _linux_,并没有什么栈栈滴

getline用 fgets 改写

os__home_dir()函数 改写出windows的目录

ifdef windows

//home = os__getenv(tos2("HOMEDRIVE"));
//home = string_add(home, os__getenv(tos2("HOMEPATH")));
int max = 256;
byte buf = v_malloc(max);
GetModuleFileName(NULL, buf, max);
int nLen=strlen(buf);
byte *p;
p= buf+nLen;
while(p!=buf)
{
if((
p == '\') || (*p == '//'))
{
*p='\x00';
break;
}
p--;
}
nLen=strlen(buf);
home = tos(buf, nLen);
home = string_add(home, tos2("/../../../"));
。。。

然后
D:\code\v\compiler>v
V 0.0.12
Use Ctrl-D to exit
For now you have to use println() to print values, this will be fixed soon

println('hell, world!')
(char code=0) pos=4428 len=4651
panic: array.v:224
invalid character ``
exit():

????

@SongTianZuo
thanks, compiled using your fixes, i run println('hell, world!'), it hang and abort

WSL下运行失败

$ vc -o v .
segmentation fault

gdb shows:

106      ../sysdeps/x86_64/strlen.S: No such file or directory

Docker环境测试例子:

$ docker pull xena/vlang:0.0.12

$ docker run --rm -it xena/vlang:0.0.12 sh
$ docker run --rm -it xena/vlang:0.0.12 /root/code/v/compiler/v

$ docker run --rm -it xena/vlang:0.0.12 /root/code/v/compiler/v run /root/code/v/examples/hello_world.v

source code updated

2019/06/23 04:57 317,523 v.c
2019/06/24 20:21 321,252 v1.c <-todays version

the latest version of v.c canbuild with mingw with replace the getline with fgets

D:\>v_x86_64
V 0.1.0
Use Ctrl-D to exit
For now you have to use println() to print values, this will be fixed soon
>>> println('hell, world!')  <--- hang and abort

全部文档已经翻译完成( https://github.com/vlang/v/issues/396 ):https://vlang-zh.cn/

V语言中文资料精选:
https://github.com/vlang-zh/awesome-vlang-zh

欢迎贡献V语言干货文章

It's now very easy to translate the website to Chinese:

https://github.com/vlang/v/wiki/Helping-to-translate-the-V-website

Was this page helpful?
0 / 5 - 0 ratings