Charlie Gibbs
2022-05-16 23:49:29 UTC
Are there any MinGW gurus out there? Or is there a better place
to ask these questions?
I wrote a suite of programs years ago; I've been compiling
the Win32 versions (a mix of console and GUI programs) with
Borland C++ Builder. I'd like to switch to MinGW so I can
use a more modern, advanced compiler. (I've been compiling
Linux versions of these programs under gcc 8.)
My ultimate goal is to build the latest version of OpenSSL, 3.0.2
(which probably can't be done with the Borland compiler), and link it
with the programs in my suite which support SSL. Ditto for LibSSH2.
OpenSSL comes with build instructions for MinGW.
I've installed MinGW and have successfully compiled and run small
test programs, both console and GUI. So far, though, I've not
succeeded in getting my suite to compile (although a few of the
simplest programs, both console and GUI, do compile and run).
The program I'm currently trying to compile is a console program
which comes up with the following messages:
gcc -c revdate.c
gcc -DWIN32 -DMINGW -Wall -Wno-format-overflow -c adjcost.c
gcc -Wall -Wl,--allow-multiple-definition -o MinGW/adjcost.exe adjcost.o revdate.o MinGW/genesis.a
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x4aea): undefined reference to `***@16'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x580a): undefined reference to `***@20'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x5836): undefined reference to `***@8'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x592c): undefined reference to `***@8'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x5a57): undefined reference to `***@20'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x6e11): undefined reference to `***@8'
collect2.exe: error: ld returned 1 exit status
make: *** [MinGW/adjcost.exe] Error 1
Yes, I know that these APIs are normally only used in GUI programs,
but they're a part of a private library I link with all my programs,
GUI or console. The Borland compiler handles this with no complaints.
If I add the -mwindows parameter to the gcc calls, the error messages
disappear. But I want a console program, not a GUI program; besides,
for GUI programs compiled with MinGW, printf() doesn't print anything.
There are other problems (see the -Wl,--allow-multiple-definition
parameter above), but getting rid of the error messages above seems
like a good place to start.
Is there a good source of documentation for building Windows programs
with MinGW? I've searched high and low, but when it comes down to the
nitty-gritty I've found little information, especially on the magical
incantations to include needed libraries (e.g. -lws2_32 for sockets,
something I only found out from back-handed references in various
discussion groups).
If anyone can help, or point me to a better newsgroup, web site,
or documentation source, I'd really appreciate it.
to ask these questions?
I wrote a suite of programs years ago; I've been compiling
the Win32 versions (a mix of console and GUI programs) with
Borland C++ Builder. I'd like to switch to MinGW so I can
use a more modern, advanced compiler. (I've been compiling
Linux versions of these programs under gcc 8.)
My ultimate goal is to build the latest version of OpenSSL, 3.0.2
(which probably can't be done with the Borland compiler), and link it
with the programs in my suite which support SSL. Ditto for LibSSH2.
OpenSSL comes with build instructions for MinGW.
I've installed MinGW and have successfully compiled and run small
test programs, both console and GUI. So far, though, I've not
succeeded in getting my suite to compile (although a few of the
simplest programs, both console and GUI, do compile and run).
The program I'm currently trying to compile is a console program
which comes up with the following messages:
gcc -c revdate.c
gcc -DWIN32 -DMINGW -Wall -Wno-format-overflow -c adjcost.c
gcc -Wall -Wl,--allow-multiple-definition -o MinGW/adjcost.exe adjcost.o revdate.o MinGW/genesis.a
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x4aea): undefined reference to `***@16'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x580a): undefined reference to `***@20'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x5836): undefined reference to `***@8'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x592c): undefined reference to `***@8'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x5a57): undefined reference to `***@20'
c:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: MinGW/genesis.a(gensubs.o):gensubs.c:(.text+0x6e11): undefined reference to `***@8'
collect2.exe: error: ld returned 1 exit status
make: *** [MinGW/adjcost.exe] Error 1
Yes, I know that these APIs are normally only used in GUI programs,
but they're a part of a private library I link with all my programs,
GUI or console. The Borland compiler handles this with no complaints.
If I add the -mwindows parameter to the gcc calls, the error messages
disappear. But I want a console program, not a GUI program; besides,
for GUI programs compiled with MinGW, printf() doesn't print anything.
There are other problems (see the -Wl,--allow-multiple-definition
parameter above), but getting rid of the error messages above seems
like a good place to start.
Is there a good source of documentation for building Windows programs
with MinGW? I've searched high and low, but when it comes down to the
nitty-gritty I've found little information, especially on the magical
incantations to include needed libraries (e.g. -lws2_32 for sockets,
something I only found out from back-handed references in various
discussion groups).
If anyone can help, or point me to a better newsgroup, web site,
or documentation source, I'd really appreciate it.
--
/~\ Charlie Gibbs | Life is perverse.
\ / <***@kltpzyxm.invalid> | It can be beautiful...
X I'm really at ac.dekanfrus | but it won't.
/ \ if you read it the right way. | -- Lily Tomlin
/~\ Charlie Gibbs | Life is perverse.
\ / <***@kltpzyxm.invalid> | It can be beautiful...
X I'm really at ac.dekanfrus | but it won't.
/ \ if you read it the right way. | -- Lily Tomlin