Skip to content

v2 error when building program - unknown top stmt #27009

@programmingkidx

Description

@programmingkidx

Describe the bug

When trying to build a program using v2 I see an error message printed.

Reproduction Steps

Create a file called main.v.
Add this code to the file and save it: println("Hello from v")
Run this command: v -v2 main.v

Expected Behavior

V2 should be able to create a binary program file.

Current Behavior

This error is printed:

main.v:1:1 -> error: unknown top stmt: name - main.v:1
    1 | println("Hello from v")

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.5.1 c5efd0f

Environment details (OS name and version, etc.)

V full version V 0.5.1 c5efd0f
OS macos, macOS, 12.3.1, 21E258
Processor 8 cpus, 64bit, little endian, Apple M1
Memory 0.2GB/16GB
V executable /Users/user/Documents/Development/Projects/Vlang/V source code/git-repo/v/v
V last modified time 2026-04-27 14:31:50
V home dir contains spaces, value: /Users/user/Documents/Development/Projects/Vlang/V source code/git-repo/v
VMODULES OK, value: /Users/user/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/user/Desktop
Git version git version 2.36.1
V git status weekly.2026.07-1534-gc5efd0f6
.git/config present true
cc version Apple clang version 13.1.6 (clang-1316.0.21.2.3)
gcc version Apple clang version 13.1.6 (clang-1316.0.21.2.3)
clang version Apple clang version 13.1.6 (clang-1316.0.21.2.3)
tcc version tcc version 0.9.28rc 2026-01-10 HEAD@5ec0e6f8 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 f995efa3
emcc version N/A
glibc version N/A

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