Skip to content

[BUG] Failing to build hello.cpp2 with Visual Studio 2026 #1440

@thekovic

Description

@thekovic

Describe the bug
I am following the tutorial and I'm failing to build the hello.cpp2 example with Visual Studio 2026 (Microsoft (R) C/C++ Optimizing Compiler Version 19.50.35719 for x64).

To Reproduce
Steps to reproduce the behavior:

  1. Sample code - distilled down to minimal essentials please
main: () = {
    words: std::vector = ( "Alice", "Bob" );
    hello( words[0] );
    hello( words[1] );
}

hello: (msg: std::string_view) = {
    std::cout << "Hello, (msg)$!\n";
}
  1. Command lines (called from "Developer Powershell for VS 18")
.\cppfront.exe .\hello.cpp2 -p
cl hello.cpp -std:c++20 -EHsc -I ~\c\cppfront\include\
  1. Expected result - successful compilation
  2. Actual result/error
C:\Users\kovic\c\hellocpp2\cpp2util.h(60): error C2230: could not find module 'std.compat'
C:\Users\kovic\c\hellocpp2\cpp2util.h(437): error C2039: 'int8_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(437): error C2061: syntax error: identifier 'int8_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(438): error C2039: 'int16_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(438): error C2061: syntax error: identifier 'int16_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(439): error C2039: 'int32_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(439): error C2061: syntax error: identifier 'int32_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(440): error C2039: 'int64_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(440): error C2061: syntax error: identifier 'int64_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(441): error C2039: 'uint8_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(441): error C2061: syntax error: identifier 'uint8_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(442): error C2039: 'uint16_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(442): error C2061: syntax error: identifier 'uint16_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(443): error C2039: 'uint32_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(443): error C2061: syntax error: identifier 'uint32_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(444): error C2039: 'uint64_t': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(444): error C2061: syntax error: identifier 'uint64_t'
C:\Users\kovic\c\hellocpp2\cpp2util.h(473): error C3878: syntax error: unexpected token '>' following 'simple-type-specifier'
C:\Users\kovic\c\hellocpp2\cpp2util.h(473): note: missing one of: '(' '{' ?
C:\Users\kovic\c\hellocpp2\cpp2util.h(495): error C3878: syntax error: unexpected token '>' following 'simple-type-specifier'
C:\Users\kovic\c\hellocpp2\cpp2util.h(495): note: missing one of: '(' '{' ?
C:\Users\kovic\c\hellocpp2\cpp2util.h(495): error C2988: unrecognizable template declaration/definition
C:\Users\kovic\c\hellocpp2\cpp2util.h(495): error C2059: syntax error: '>'
C:\Users\kovic\c\hellocpp2\cpp2util.h(496): error C2039: 'is_arithmetic_v': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(497): error C2059: syntax error: ')'
C:\Users\kovic\c\hellocpp2\cpp2util.h(498): error C2059: syntax error: ')'
C:\Users\kovic\c\hellocpp2\cpp2util.h(499): error C2143: syntax error: missing ';' before '{'
C:\Users\kovic\c\hellocpp2\cpp2util.h(499): error C2447: '{': missing function header (old-style formal list?)
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): error C3878: syntax error: unexpected token '>' following 'decltype-specifier'
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): note: missing one of: '(' '{' ?
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): error C2760: syntax error: '>' was unexpected here; expected ')'
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): error C3878: syntax error: unexpected token '(' following 'expression'
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): error C2760: syntax error: ')' was unexpected here; expected ';'
C:\Users\kovic\c\hellocpp2\cpp2util.h(508): error C3878: syntax error: unexpected token ')' following 'jump-statement'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2039: 'string': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2365: 'cpp2::message_to_cstr_adapter': redefinition; previous definition was 'function'
C:\Users\kovic\c\hellocpp2\cpp2util.h(539): note: see declaration of 'cpp2::message_to_cstr_adapter'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2065: 'string': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2760: syntax error: 'const' was unexpected here; expected ')'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2059: syntax error: 'const'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2143: syntax error: missing ';' before '{'
C:\Users\kovic\c\hellocpp2\cpp2util.h(540): error C2447: '{': missing function header (old-style formal list?)
C:\Users\kovic\c\hellocpp2\cpp2util.h(544): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(544): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(550): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(550): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(552): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(552): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(551): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(553): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2039: 'string_view': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C3829: attribute [[noreturn]] may only be applied to a function declaration
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2065: 'string_view': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2760: syntax error: 'group' was unexpected here; expected ')'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2146: syntax error: missing ')' before identifier 'group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C3083: 'source_location': the symbol to the left of a '::' must be a type
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2039: 'current': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2143: syntax error: missing ';' before '{'
C:\Users\kovic\c\hellocpp2\cpp2util.h(558): error C2447: '{': missing function header (old-style formal list?)
C:\Users\kovic\c\hellocpp2\cpp2util.h(575): error C7746: 'cpp2::report_and_terminate': cannot appear in its own initializer
C:\Users\kovic\c\hellocpp2\cpp2util.h(574): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(574): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(575): error C3536: 'cpp2::report_and_terminate': cannot be used before it is initialized
C:\Users\kovic\c\hellocpp2\cpp2util.h(575): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): error C2440: '<function-style-cast>': cannot convert from 'cpp2::<lambda>@cpp2_default@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): note: 'cpp2::contract_group::contract_group': no overloaded function could convert all the argument types
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: could be 'cpp2::contract_group::contract_group(cpp2::contract_group &&)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): note: 'cpp2::contract_group::contract_group(cpp2::contract_group &&)': cannot convert argument 1 from 'cpp2::<lambda>@cpp2_default@cpp2' to 'cpp2::contract_group &&'
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): note: Reason: cannot convert from 'cpp2::<lambda>@cpp2_default@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: or       'cpp2::contract_group::contract_group(const cpp2::contract_group &)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): note: 'cpp2::contract_group::contract_group(const cpp2::contract_group &)': cannot convert argument 1 from 'cpp2::<lambda>@cpp2_default@cpp2' to 'const cpp2::contract_group &'
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): note: Reason: cannot convert from 'cpp2::<lambda>@cpp2_default@cpp2' to 'const cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(546): note: or       'cpp2::contract_group::contract_group(cpp2::contract_group::handler)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): note: 'cpp2::contract_group::contract_group(cpp2::contract_group::handler)': cannot convert argument 1 from 'cpp2::<lambda>@cpp2_default@cpp2' to 'cpp2::contract_group::handler'
C:\Users\kovic\c\hellocpp2\cpp2util.h(576): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(573): note: while trying to match the argument list '(cpp2::<lambda>@cpp2_default@cpp2)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(579): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(579): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(580): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): error C2440: '<function-style-cast>': cannot convert from 'cpp2::<lambda>@bounds_safety@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): note: 'cpp2::contract_group::contract_group': no overloaded function could convert all the argument types
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: could be 'cpp2::contract_group::contract_group(cpp2::contract_group &&)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): note: 'cpp2::contract_group::contract_group(cpp2::contract_group &&)': cannot convert argument 1 from 'cpp2::<lambda>@bounds_safety@cpp2' to 'cpp2::contract_group &&'
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): note: Reason: cannot convert from 'cpp2::<lambda>@bounds_safety@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: or       'cpp2::contract_group::contract_group(const cpp2::contract_group &)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): note: 'cpp2::contract_group::contract_group(const cpp2::contract_group &)': cannot convert argument 1 from 'cpp2::<lambda>@bounds_safety@cpp2' to 'const cpp2::contract_group &'
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): note: Reason: cannot convert from 'cpp2::<lambda>@bounds_safety@cpp2' to 'const cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(546): note: or       'cpp2::contract_group::contract_group(cpp2::contract_group::handler)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): note: 'cpp2::contract_group::contract_group(cpp2::contract_group::handler)': cannot convert argument 1 from 'cpp2::<lambda>@bounds_safety@cpp2' to 'cpp2::contract_group::handler'
C:\Users\kovic\c\hellocpp2\cpp2util.h(581): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(578): note: while trying to match the argument list '(cpp2::<lambda>@bounds_safety@cpp2)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(584): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(584): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(585): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): error C2440: '<function-style-cast>': cannot convert from 'cpp2::<lambda>@null_safety@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): note: 'cpp2::contract_group::contract_group': no overloaded function could convert all the argument types
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: could be 'cpp2::contract_group::contract_group(cpp2::contract_group &&)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): note: 'cpp2::contract_group::contract_group(cpp2::contract_group &&)': cannot convert argument 1 from 'cpp2::<lambda>@null_safety@cpp2' to 'cpp2::contract_group &&'
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): note: Reason: cannot convert from 'cpp2::<lambda>@null_safety@cpp2' to 'cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(556): note: or       'cpp2::contract_group::contract_group(const cpp2::contract_group &)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): note: 'cpp2::contract_group::contract_group(const cpp2::contract_group &)': cannot convert argument 1 from 'cpp2::<lambda>@null_safety@cpp2' to 'const cpp2::contract_group &'
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): note: Reason: cannot convert from 'cpp2::<lambda>@null_safety@cpp2' to 'const cpp2::contract_group'
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(546): note: or       'cpp2::contract_group::contract_group(cpp2::contract_group::handler)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): note: 'cpp2::contract_group::contract_group(cpp2::contract_group::handler)': cannot convert argument 1 from 'cpp2::<lambda>@null_safety@cpp2' to 'cpp2::contract_group::handler'
C:\Users\kovic\c\hellocpp2\cpp2util.h(586): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\kovic\c\hellocpp2\cpp2util.h(583): note: while trying to match the argument list '(cpp2::<lambda>@null_safety@cpp2)'
C:\Users\kovic\c\hellocpp2\cpp2util.h(589): error C2039: 'source_location': is not a member of 'std'
predefined C++ types (compiler internal)(359): note: see declaration of 'std'
C:\Users\kovic\c\hellocpp2\cpp2util.h(589): error C2061: syntax error: identifier 'source_location'
C:\Users\kovic\c\hellocpp2\cpp2util.h(590): error C2065: 'where': undeclared identifier
C:\Users\kovic\c\hellocpp2\cpp2util.h(590): fatal error C1003: error count exceeds 100; stopping compilation

I am sure this is a big oversight on my part because I wouldn't believe it's just outright broken so please let me know where I went wrong. Thank you <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions