From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B92E3858D39; Mon, 3 Apr 2023 11:34:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B92E3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680521655; bh=pgCIbyQ2OEKcOMEC5ayzfQxK+CFg8BAVEwqjANAk11w=; h=From:To:Subject:Date:From; b=AiNKUn2p8nR75kIwhBQbW3LepcCc1ICHjXKJrrwOVKqxaLuQRVMhTau28UqOL5PyK 4GPEBd1MKtNVcd1pXtKFcYYPgernucKbwRcIjRS9FmRSQ9U/N2/kYBDCug5p5zd+Go vw16NfAIq9n1LtQzKbMUVb0kYP4vISfgiyvUBJ6s= From: "frechbengel at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109389] New: g++ file.cpp -lgmp (option only works after filename) Date: Mon, 03 Apr 2023 11:34:14 +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: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: frechbengel at gmx dot de 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=3D109389 Bug ID: 109389 Summary: g++ file.cpp -lgmp (option only works after filename) Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: frechbengel at gmx dot de Target Milestone: --- Hello, 1. =C2=BBg++ --version=C2=AB outputs: g++ (Debian 10.2.1-6) 10.2.1 20210110 2. =C2=BBg++ --help=C2=AB says: Usage: g++ [options] file... 3. But if I try to compile: #include int main(){ mpz_t n; mpz_init(n); mpz_clear(n); return 0;} 4. with =C2=BBg++ -lgmp file.cpp=C2=AB the error is: /usr/bin/ld: /tmp/cc8lgHAc.o: in function `main': guard_driver.cpp:(.text+0x10): undefined reference to `__gmpz_init' /usr/bin/ld: guard_driver.cpp:(.text+0x21): undefined reference to `__gmpz_set_ui' /usr/bin/ld: guard_driver.cpp:(.text+0x34): undefined reference to `operator<<(std::ostream&, __mpz_struct const*)' /usr/bin/ld: guard_driver.cpp:(.text+0x55): undefined reference to `__gmpz_clear' collect2: error: ld returned 1 exit status 5. There is no error if I compile with: =C2=BBg++ file.cpp -lgmp=C2=AB 6. As the --help says the options should be given BEFORE the filename it is= a feature if it works with options given after the filename, too. But I is propably a bug that compilation only works with the option given after the filename. Regards and thank you for you valuable work Bernd=