V语言环境的搭建与编译

V语言是一种静态类型的编译型编程语言,它与Go类似,也受到  Oberon、Rust、Swift语言的影响。
 

 

Linux:
#install clang

arron@SW-DERVER:~$ sudo apt install clang                                                                                                        
Setting up llvm-3.8-dev (1:3.8-2ubuntu4) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.21) ...
Processing triggers for ureadahead (0.100.0-19) ...

#check version
arron@SW-DERVER:~$ clang -v
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

#...好像不需要。。。
arron@SW-DERVER:~$ sudo apt install linuxbrew-wrapper
Processing triggers for libc-bin (2.23-0ubuntu10) ...

 

#下载源码
arron@SW-DERVER:~$ git clone https://github.com/vlang/v
Cloning into 'v'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 3684 (delta 14), reused 24 (delta 14), pack-reused 3655
Receiving objects: 100% (3684/3684), 1.90 MiB | 450.00 KiB/s, done.
Resolving deltas: 100% (2302/2302), done.
Checking connectivity... done.
arron@SW-DERVER:~$ cd v
arron@SW-DERVER:~/v$ ls
azure-pipelines.yml  CONDUCT.md       LICENSE   README.md   vlib
CHANGELOG.md         CONTRIBUTING.md  make.bat  test.zsh
compiler             examples         Makefile  thirdparty
arron@SW-DERVER:~/v/compiler$ cd ..
arron@SW-DERVER:~/v$ ls
azure-pipelines.yml  CONDUCT.md       LICENSE   README.md   vlib
CHANGELOG.md         CONTRIBUTING.md  make.bat  test.zsh
compiler             examples         Makefile  thirdparty
#编译源码
arron@SW-DERVER:~/v$ make
rm -f v.c .v.c v vprod thirdparty/**/*.o
curl -Os https://raw.githubusercontent.com/vlang/vc/master/v.c
cc -std=gnu11 -w -o v v.c -lm
./v -o v compiler
V has been successfully built
arron@SW-DERVER:~/v$ ls
azure-pipelines.yml  CONDUCT.md       LICENSE   README.md   v
CHANGELOG.md         CONTRIBUTING.md  make.bat  test.zsh    v.c
compiler             examples         Makefile  thirdparty  vlib
arron@SW-DERVER:~/v$ ./v
V 0.1.15
Use Ctrl-C or `exit` to exit
>>> println('Hello World')
Hello World
 
mac:
在V'lang的开源社区里有
https://www.v-lang.cn/article/4
 
编译:
arron@SW-DERVER:~/v_test$ ../v/v t.v
arron@SW-DERVER:~/v_test$ ls
t  t.v
 

你可能感兴趣的:(V语言,V语言的环境搭建,Linux,下安装V语言,Mac,下安装V语言)