Skip to content

[Windows] fprintf miss matching with GCC #27512

Description

@K1ndWha1e

Describe the bug

After running any program with gcc, I received this error.

Reproduction Steps

fn main() {
        print("HERE")
}
v -cc gcc run .\main.v

Expected Behavior

Prints "HERE"

Current Behavior

================== C compilation error (from gcc): ==============
cc: C:\\Users\\nikit\\AppData\\Local\\Temp\\v_0\\TE2216~1.C: In function 'builtin___memory_panic':
cc: C:\\Users\\nikit\\AppData\\Local\\Temp\\v_0\\TE2216~1.C:1952:17: error: implicit declaration of function 'fprintf' [-Werror=implicit-function-declaration]
cc:  1952 |                 fprintf(stderr, "%p", ((voidptr)(size)));
cc:       |                 ^~~~~~~
cc: C:\\Users\\nikit\\AppData\\Local\\Temp\\v_0\\TE2216~1.C:1257:1: note: include '<stdio.h>' or provide a declaration of 'fprintf'
cc:  1256 | #include <float.h>
cc:   +++ |+#include <stdio.h>
cc:  1257 | #else
cc: C:\\Users\\nikit\\AppData\\Local\\Temp\\v_0\\TE2216~1.C:1952:17: warning: incompatible implicit declaration of built-in function 'fprintf' [-Wbuiltin-declaration-mismatch]
cc:  1952 |                 fprintf(stderr, "%p", ((voidptr)(size)));
cc:       |                 ^~~~~~~
cc: C:\\Users\\nikit\\AppData\\Local\\Temp\\v_0\\TE2216~1.C:1952:17: note: include '<stdio.h>' or provide a declaration of 'fprintf'
...
cc: cc1.exe: some warnings being treated as errors
(note: the original output was 36 lines long; it was truncated to its first 12 lines + the last line)
=================================================================
Try passing `-g` when compiling, to see a .v file:line information, that correlates more with the C error.
(Alternatively, pass `-show-c-output`, to print the full C error message).
builder error: 
==================
C function `C.fprintf` was declared in V, but the C compiler did not see a matching C declaration for `fprintf`.
A declaration like `fn C.fprintf()` only tells V about an external C symbol; it does not define that symbol or include its header.
Include the C header that declares `fprintf` and add any needed `#flag -I`, `#flag -l`, or C source file.
If there is no header but the symbol is provided by a linked library/object, mark the V declaration with `@[c_extern]`.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.5.1 a3c8c55

Environment details (OS name and version, etc.)

V full version V 0.5.1 9b26b5d.a3c8c55
OS windows, Њ ©Єа®б®дв Windows 10 Pro 19045 64-а §ап¤ п
Processor 12 cpus, 64bit, little endian, Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory 45.98GB/63.92GB
V executable C:\Users\nikit\Downloads\v\v.exe
V last modified time 2026-06-20 16:54:08
V home dir OK, value: C:\Users\nikit\Downloads\v
VMODULES OK, value: C:\Users\nikit.vmodules
VTMP OK, value: C:\Users\nikit\AppData\Local\Temp\v_0
Current working dir OK, value: C:\Users\nikit\CExploringLab\PROJECTS\tiny-gpu-watcher
Git version git version 2.47.1.windows.2
V git status a3c8c55
.git/config present true
cc version cc (Rev6, Built by MSYS2 project) 13.1.0
gcc version gcc (Rev6, Built by MSYS2 project) 13.1.0
clang version clang version 18.1.1
msvc version ЋЇвЁ¬Ё§ЁагойЁ© Є®¬ЇЁ«пв®а Microsoft (R) C/C++ ўҐабЁЁ 19.43.34808 ¤«п x64
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82-dirty
emcc version N/A
glibc version N/A

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions