From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9B15A3858D28; Thu, 29 Sep 2022 09:59:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B15A3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664445568; bh=D2FoOW9tvePGX6ehOXtZ0e0PIW8tbS8WQE7yDsM6iSQ=; h=From:To:Subject:Date:From; b=MXZmt4fXC0WG7U0q5pMV6oyJqOUQtxnHx6+NaZS2cosr7BBjrLMOovEgeBei4G5pK M0R16woS5c4uTwXfNgsgNaYVySfh8Xs2YLNEOMFiZSg3v7t/bcByupR87aN/FhggV/ oN71IcKEKr6C6zDGPdEJaBbkh75laKvshKj8gVYA= From: "karl.weber99 at gmx dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107084] New: Program does not link with Standard Library Header Unit but with correspoding #include Date: Thu, 29 Sep 2022 09:59:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: karl.weber99 at gmx dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107084 Bug ID: 107084 Summary: Program does not link with Standard Library Header Unit but with correspoding #include Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: karl.weber99 at gmx dot net Target Milestone: --- When I compile iostream with=20 g++ -fmodules-ts -std=3Dc++20 -c -x c++-system-header iostream and use "import ;" the program does not link. When I use "#include " instead, it does link and run. Commands: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D g++ -fmodules-ts -std=3Dc++20 -c -x c++ employee.cppm g++ -fmodules-ts -std=3Dc++20 -c structtest_fmt.cpp g++ -o structtest structtest_fmt.o employee.o -lfmt /usr/bin/ld: structtest_fmt.o: in function `main': structtest_fmt.cpp:(.text+0xfb): undefined reference to `fmt::v9::vformat(fmt::v9::basic_string_view, fmt::v9::basic_format_args >)' /usr/bin/ld: structtest_fmt.cpp:(.text+0x1ae): undefined reference to `fmt::v9::vformat(fmt::v9::basic_string_view, fmt::v9::basic_format_args >)' /usr/bin/ld: structtest_fmt.cpp:(.text+0x261): undefined reference to `fmt::v9::vformat(fmt::v9::basic_string_view, fmt::v9::basic_format_args >)' /usr/bin/ld: structtest_fmt.o: in function `std::allocator_traits >::deallocate(std::allocator&, char*, unsigned long)': structtest_fmt.cpp:(.text._ZNSt16allocator_traitsISaIcEE10deallocateERS0_Pc= m[_ZNSt16allocator_traitsISaIcEE10deallocateERS0_Pcm]+0x2d): undefined reference to `std::__is_constant_evaluated()' collect2: error: ld returned 1 exit status =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D employee.cppm =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D export module employee; export struct Employee { char firstInitial; char lastInitial; int employeeNumber; int salary; }; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D structtest_fmt.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include import ; import employee; using namespace std; int main() { // create and populate an employee Employee anEmployee; anEmployee.firstInitial =3D 'J'; anEmployee.lastInitial =3D 'D'; anEmployee.employeeNumber =3D 42; anEmployee.salary =3D 80000; // output the values of an employee cout << fmt::format("Employee: {}{}", anEmployee.firstInitial,=20 anEmployee.lastInitial) << endl; cout << fmt::format("Number: {}", anEmployee.employeeNumber) << end= l; cout << fmt::format("Salary: ${}", anEmployee.salary) << endl; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D When I replace the import iostream by the corresponding include statement (= and delete iostream.gcm, then is compiles, links and runs successfully.=