Open downfall85 opened 1 week ago
I Have Same Problem.
On Linux (as shared library):
# v -cc gcc -skip-unused -d no_main -no-builtin -shared -gc none -o name.so name.v
# g++ main.cpp name.so
# LD_LIBRARY_PATH=. ./a.out
Test
Compiling .c and .cpp files separately and linking later (object files):
# v -d no_main -skip-unused -no-builtin -gc none -o name.c name.v
# g++ -x c -c name.c -o name.o
# g++ -c main.cpp -o main.o
# g++ main.o name.o
# ./a.out
Test
Can you try again building from master?
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