Skip to content

Multiple definition errors (unguarded generated main.h?) #148

@nardi

Description

@nardi

I made a simple file hello.kit file containing:

function main() {
    printf("%s\n", "Hello from Kit!");
}

and tried to compile it using kitc hello.kit. At the linking stage I get a bunch of "multiple definition" errors for all kinds of symbols (e.g. kit_mem_Allocator__...). This seems logical, as the generated build/include/main.h file contains these definitions, but it is included in every .c-file and does not contain a header guard or similar. I assume this is not intended behavior, so what could be going wrong on my side?

Environment

[2020-08-01 16:26:57.1947] ===> kitc version
[2020-08-01 16:26:57.2686] DBG: 0.1.0
[2020-08-01 16:26:57.3465] ===> OS
[2020-08-01 16:26:57.4413] DBG: mingw32
[2020-08-01 16:26:57.4813] ===> Source paths
[2020-08-01 16:26:57.5721] ===> Standard prelude location
[2020-08-01 16:26:57.6480] DBG: C:\tools\kit\std\prelude.kit
[2020-08-01 16:26:57.6900] ===> ** COMPILER **
[2020-08-01 16:26:57.7339] ===> Toolchain
[2020-08-01 16:26:57.7898] DBG: C:\tools\kit\toolchains\windows-mingw
[2020-08-01 16:26:57.8433] ===> Compiler
[2020-08-01 16:26:58.6820] DBG: gcc
gcc (Rev1, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[2020-08-01 16:26:59.4545] ===> Include paths
[2020-08-01 16:26:59.4745] DBG: []
[2020-08-01 16:26:59.5274] ===> Compiler flags
[2020-08-01 16:26:59.5723] DBG: ["-D__USE_MINGW_ANSI_STDIO","-std=c99","-pedantic","-O3","-Os","-Wno-missing-braces","-Wno-shift-op-parentheses"]
[2020-08-01 16:26:59.7491] ===> Linker flags
[2020-08-01 16:26:59.7810] DBG: ["-std=c99","-pedantic","-O3","-Os","-Wno-missing-braces","-Wno-shift-op-parentheses"]

I see mingw32 here, not mingw64, is that a problem? I got it from the scoop package, but am using my existing install of gcc-mingw64 via msys2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions