Re: Linker undefined reference error, fresh MinGW install

Derek Harter <[email protected]> Sat, 6 Jun 2020 06:55:33 -0500
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <CAJkeYCqGX0qzDJp1ia=msT40A7d=RK0jqLm=7NLaxY_by=gR7Q@mail.gmail.com>
Thanks that is exactly what I wanted to find out.

Yes it is 5.3.2.  This was the version that you currently get when you go
to www.mingw.org and select the download.  After digging around it looks
like I really need to get my students to use MinGW64 with much more recent
gcc versions.

Thanks again.
Derek
--
  Derek Harter, Ph.D., Associate Professor
  Computer Science and Information Systems (SCI 355)
  Texas A&M University
  PO Box 3011
  Commerce, TX 75429
  Tel: (903) 468-8762 / Fax: (903) 886-5404
  Email: [email protected]
  URL: http://harter.pro
  PGP Public Key:
       http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x613BC988DE797012
    - 3, 2, 1, Lets Jam!


On Sat, Jun 6, 2020 at 1:46 AM Eli Zaretskii <eliz-mXXj517/[email protected]> wrote:

> > From: Derek Harter <[email protected]>
> > Date: Fri, 5 Jun 2020 19:29:47 -0500
> >
> > I'm wondering if anyone has more information or knows what the issue is
> here.  I am using a fresh MinGW
> > install with GCC 9.2.0 on Windows 10.
> >
> > ```
> > C:\Users\dash\repos\link-bug>g++ --version
> > g++ (MinGW.org GCC Build-20200227-1) 9.2.0
> > Copyright (C) 2019 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.
> > ```
> >
> > The following minimal example causes a linker undefined error with
> g++/ld.
> >
> > ```c++
> > #include <iostream>
> > #include <string>
> > using namespace std;
> >
> > int main(int argc, char* argv[])
> > {
> >   cout << to_string(42) << endl;
> >   return 0;
> > }
> > ```
> >
> > ```
> > C:\Users\dash\repos\link-bug>g++ main.cpp -o main
> > c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
> >
> c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(mbrscan.o):(.text+0xb6):
> undefined reference to
> > `SetLastError@4'
> > c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
> >
> c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(wcharmap.o):(.text+0x208):
> undefined reference to
> > `WideCharToMultiByte@32'
> > c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
> >
> c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0xbe):
> undefined reference to
> > `GetCPInfo@8'
> > c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:
> >
> c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0x143):
> undefined reference to
> > `GetCPInfo@8'
> > collect2.exe: error: ld returned 1 exit status
> > ```
> >
> > Any ideas?  That should of course link without needing to specify any
> additional libraries for linking.  The
> > minimal example works fine on Gnu GCC 9.3.0 on linux and on MacOS.
>
> Are you using MinGW Runtime v5.3.2?  If so, upgrade to 5.3.3 or
> downgrade to 5.3.1.  This seems to be a known problem with 5.3.2.
>
> _______________________________________________
> MinGW-Users mailing list
> [email protected]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list
> etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.osdn.me/mailman/listinfo/mingw-users
> Also: mailto:[email protected]?subject=unsubscribe

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe