V version: 0.1.19 79a98d7
OS: GNU/Linux Manjaro 5.2.11-1 x86_64
What did you do?
json.vimport json
struct User {
name string
age int
}
fn main() {
s := '[{"name":"Frodo", "age":25}, {"name":"Bobby", "age":10}]'
users := json.decode([]User, s) or { // json.decode untuk decode
eprintln('Failed to parse json')
return
}
for user in users {
println('$user.name: $user.age')
}
//~ println(json.encode(users)) // untuk encode
}
v run json.vWhat did you expect to see?
Frodo: 25
Bobby: 10
What did you see instead?
$ v run json.v
/usr/lib/vlang/thirdparty/cJSON/cJSON.o not found, building it...
Assembler messages:
Fatal error: can't create /usr/lib/vlang/thirdparty/cJSON/cJSON.o: Permission denied
cc: error: /usr/lib/vlang/thirdparty/cJSON/cJSON.o: No such file or directory
V error: C error. This should never happen. Please create a GitHub issue: https://github.com/vlang/v/issues/new/choose
V version: 0.1.24 0d93eeb
/usr/lib/vlang/thirdparty/cJSON/cJSON.o not found, building it...
failed thirdparty object build cmd: cc -fPIC -I "/usr/lib/vlang/thirdparty/cJSON" -c -o "/usr/lib/vlang/thirdparty/cJSON/cJSON.o" "/usr/lib/vlang/thirdparty/cJSON/cJSON.c"
V error: Assembler messages:
Fatal error: can't create /usr/lib/vlang/thirdparty/cJSON/cJSON.o: Permission denied
@egodasa why you put v under root directory ?
NOT RECOMMENEDED
~$ sudo su
~$ v run json.v
alternative, put v somewhere in your home directory. then create a symlink to/usr/bin/
@bokunodev V installed via AUR on manjaro. Looks like the executable are placed under root directory by AUR scripts. Looks like this is not a bug. I will close the issue now.