[Mingw-users] Link problems

Back to archive index
Peter Williams petes****@gmail*****
Mon Jun 1 05:03:44 JST 2020


Thank you Eli
Both -mwindows and -mconsole are needed: -mconsole specifies the type of
output (MS-DOS window rather than a dll app,say)
The command lines compile and run perfectly on my un-upgraded laptop but
not on my upgraded desktop which what I am showing here.
With -v flag gives the following (error messages are the same).

C:\Pete\PlPXmpl>gcc -c -I C:\plplot32\include\plplot x03.c

C:\Pete\PlPXmpl>gcc -v -o x03.exe x03.o C:\plplot32\lib\libcsirocsa.a
 C:\plplot32\lib\libplplot.a C:\plplot32\lib\libqsastime.a  -mconsole
-mwindows -lm

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-9.2.0/configure --build=x86_64-pc-linux-gnu
--host=mingw32 --target=mingw32 --disable-win32-registry --with-arch=i586
--with-tune=generic --enable-static --enable-shared --enable-threads
--enable-languages=c,c++,objc,obj-c++,fortran,ada --with-dwarf2
--disable-sjlj-exceptions --enable-version-specific-runtime-libs
--enable-libgomp --disable-libvtv --with-libiconv-prefix=/mingw
--with-libintl-prefix=/mingw --enable-libstdcxx-debug
--disable-build-format-warnings --prefix=/mingw --with-gmp=/mingw
--with-mpfr=/mingw --with-mpc=/mingw --with-isl=/mingw --enable-nls
--with-pkgversion='MinGW.org GCC Build-20200227-1'
Thread model: win32
gcc version 9.2.0 (MinGW.org GCC Build-20200227-1)
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/9.2.0/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-o' 'x03.exe' '-mconsole' '-mwindows'
'-mtune=generic' '-march=i586'
 c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/collect2.exe -plugin
c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/liblto_plugin-0.dll
-plugin-opt=c:/mingw/bin/../libexec/gcc/mingw32/9.2.0/lto-wrapper.exe
-plugin-opt=-fresolution=C:\Users\petes\AppData\Local\Temp\cc5uSPSX.res
-plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lmingwex
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh
-plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmsvcrt
-plugin-opt=-pass-through=-lgdi32 -plugin-opt=-pass-through=-lcomdlg32
-plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32
-plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32
-plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lmingwex
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh
-plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmsvcrt
--subsystem windows --subsystem console -Bdynamic -o x03.exe
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../crt2.o
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/crtbegin.o
-Lc:/mingw/bin/../lib/gcc/mingw32/9.2.0 -Lc:/mingw/bin/../lib/gcc
-Lc:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/lib
-Lc:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../.. x03.o
C:\plplot32\lib\libcsirocsa.a C:\plplot32\lib\libplplot.a
C:\plplot32\lib\libqsastime.a -lm -lmingw32 -lmingwex -lgcc -lgcc_eh
-lmoldname -lmsvcrt -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -luser32
-lkernel32 -lmingw32 -lmingwex -lgcc -lgcc_eh -lmoldname -lmsvcrt
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/crtend.o

Best wishes, Peter

On Sun, 31 May 2020 at 15:52, Eli Zaretskii <eliz****@gnu*****> wrote:

> > From: Peter Williams <petes****@gmail*****>
> > Date: Sun, 31 May 2020 11:17:46 +0100
> >
> > gcc -c -I C:\plplot32\include\plplot x03.c
> > gcc -o x03.exe x03.o C:\plplot32\lib\libcsirocsa.a
> C:\plplot32\lib\libplplot.a C:\plplot32\lib\libqsastime.a
> > -mconsole -mwindows -lm
>
> Why are you using both -mconsole and -mwindows?  Don't they contradict
> each other?
>
> > 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 at 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 at 32'
>
> These look like either missing import libraries on the link command
> line, or maybe some snafu with including windows.h, which declares
> these functions.  The former problem could have been caused by the
> fact that you used both -mconsole and -mwindows.  I suggest to add -v
> to the GCC command line and see which libraries it scans.
>
> _______________________________________________
> MinGW-Users mailing list
> MinGW****@lists*****
>
> 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:mingw****@lists*****?subject=unsubscribe



-- 
Peter Williams
petes****@gmail*****
27 Ramsbury Road, St. Albans, AL1 1SN, UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20200531/02fd5128/attachment.html>


More information about the MinGW-Users mailing list
Back to archive index