Including C code cache problem? #22157
Replies: 3 comments 5 replies
-
By the way, the folder https://github.com/vlang/v/tree/master/vlib/v/tests contains according to github more than 1000 entries, and not all are displayed by github and then we loose the chance to navigate there to look for more examples to try. Maybe making sub-folders can permit to see everything from github. |
Beta Was this translation helpful? Give feedback.
-
I have learn several things... I have two C libraries in a single app: One for the serial port and another for can-utils. The later requires to prevent calling standar vcan/socketcan.c.v
So far the app worked. But then I added to the app the serial port with my newbie unnecessary line libserial/libserial.c.v
I didn't expect both C libs declarations would be mixed and the later affecting the former only when combined. I wonder if apps with more than two C libraries cause problems more difficult to solve. How to know the order of includes will be called by the compiler?
|
Beta Was this translation helpful? Give feedback.
-
As for the c++ compiler, I currently have no idea why it decided to use that, instead of a c compiler. According to https://github.com/vlang/v/blob/master/vlib/v/builder/cc.v#L1082 , it will try to see if there is a corresponding If your file was named with a .c extension, it should have used a c compiler 🤔 . |
Beta Was this translation helpful? Give feedback.
-
I follow the https://docs.vlang.io/v-and-c.html#including-c-code doc to compile a c file I have. Then I had problems so copy, paste and update the code at https://github.com/vlang/v/tree/master/vlib/v/tests/project_with_c_code.
First I though was mandatory to have the C folder named exactly
c
and the c code as exactlyimplementation.c
but I wasn't the case.Then notice like a cache is causing problems, since I modifed the
.c
file to get an expected assert error but the program run correctly as if the file wasn't touched. Even I changed the name of the file in order to cannot be found but no error was indicated for the newv run
. These problems difficult the edition process.Also something strange happens when I make a typo in the line
#flag @VMODROOT/mod1/code/libx.o
and I got this:Seems the compiler thinks we want to compile a c++ file.
Ideas? V 0.4.7 da228e9
Beta Was this translation helpful? Give feedback.
All reactions