c2v icon indicating copy to clipboard operation
c2v copied to clipboard

C2V not working in windows in cJSON project

Open jechaviz opened this issue 1 year ago • 4 comments

.

jechaviz avatar Dec 20 '24 09:12 jechaviz

C:\git\ethers.objc\ethers\src\Providers\ApiProviders>v translate ApiProvider.h
C2V is not installed. Cloning C2V to C:\Users\jesus\.vmodules\c2v ...
Compiling c2v ...
================ V panic ================
   module: main
 function: find_clang_in_path()
  message: cannot find clang in PATH
     file: ./src/c2v.v:128
   v hash: 903e349
=========================================
C:/Users/jesus/AppData/Local/Temp/v_0/../../../../../..C:\Users\jesus\scoop\apps\v\0.4.8\vlib\builtin\builtin.c.v:87: at panic_debug: Backtrace
C:/Users/jesus/AppData/Local/Temp/v_0/../../../../../..C:\Users\jesus\.vmodules\c2v\src\c2v.v:128: by main__find_clang_in_path
C:/Users/jesus/AppData/Local/Temp/v_0/../../../../../..C:\Users\jesus\AppData\Local\Temp\v_0\c2v.exe.tmp.c:43449: by _vinit
C:/Users/jesus/AppData/Local/Temp/v_0/../../../../../..C:\Users\jesus\AppData\Local\Temp\v_0\c2v.exe.tmp.c:43463: by wmain
00528360 : by ???
005284c3 : by ???
7ffb4ee27374 : by ???
C2V command: "C:\Users\jesus\.vmodules\c2v\c2v.exe" "ApiProvider.h"
C2V failed to translate the C files. Please report it via GitHub.

C:\git\ethers.objc\ethers\src\Providers\ApiProviders>
```

jechaviz avatar Dec 20 '24 12:12 jechaviz

I did this also:

C:\Users\jesus\.vmodules\c2v\src>v c2v_test.v
V panic: cannot find clang in PATH
v hash: 2ab1523
C:/Users/jesus/AppData/Local/Temp/v_0/c2v_test.01JFJ2EWS4QC0P7TEJ9TR636V0.tmp.c:12618: at _v_panic: Backtrace
C:/Users/jesus/AppData/Local/Temp/v_0/c2v_test.01JFJ2EWS4QC0P7TEJ9TR636V0.tmp.c:33928: by main__find_clang_in_path
C:/Users/jesus/AppData/Local/Temp/v_0/c2v_test.01JFJ2EWS4QC0P7TEJ9TR636V0.tmp.c:38295: by _vinit
C:/Users/jesus/AppData/Local/Temp/v_0/c2v_test.01JFJ2EWS4QC0P7TEJ9TR636V0.tmp.c:38309: by wmain
0073cbb8 : by ???
0073cd1b : by ???
7ffb4ee27374 : by ???

jechaviz avatar Dec 20 '24 13:12 jechaviz

One of c2v's dependencies is the clang front-end. You can get gcc+clang from https://winlibs.com, then add the directory you extract to to your path. Then c2v will be able to find it.

JalonSolov avatar Dec 20 '24 14:12 JalonSolov

However, c2v shouldn't be panicing in the case that it can't find clang - it should give a nice error message telling you to make clang available.

JalonSolov avatar Dec 20 '24 14:12 JalonSolov