Can't compile generated C #22762
Labels
Bug
This tag is applied to issues which reports bugs.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
I would like to write a shared library in V and compile it in C to then use it in a C++ program.
When I try to compile the C++ program, I have errors that are found in the C file that was generated by V
Reproduction Steps
Here is the V file:
I used the following command to compile it to name.c:
v -shared -gc none -o name.c name.v
.Here is the cpp file:
And here is the command I use to compile the whole thing:
cl main.cpp name.c /Fe:main.exe
.And finally the error (sorry it's in french).
Expected Behavior
I should be able to compile the C++ file.
Current Behavior
It seems that msvc is not able to compile the file generated c file because I have compilation errors.
Possible Solution
I works with the option
-cc g++
:v -shared -gc none -cc g++ -o name.c name.v
Note that with this solution, the code compiles but I still have the warnings
Additional Information/Context
No response
V version
V 0.4.8 6c94c24
Environment details (OS name and version, etc.)
Windows 11
Visual Studio 17 2022
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: