From: "René Berber" <r.berber@computer.org>
To: cygwin@cygwin.com
Subject: Re: g++ linker problem with libcygwin.a
Date: Sat, 22 Oct 2011 20:17:00 -0000 [thread overview]
Message-ID: <j7v8c2$75o$1@dough.gmane.org> (raw)
In-Reply-To: <j7v4u7$il0$1@dough.gmane.org>
On 10/22/2011 2:18 PM, Philipp Kraus wrote:
> I use Cygwin with g++ for compiling my source codes and on some codes I
> get the error:
>
> /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../libcygwin.a(libcmain.o):(.text+0xa9):
> undefined reference to `_WinMain@16'
[snip]
That means the linking is being done for a GUI application. I guess you
wanted to build a console application, so you should learn what these
options for the linker mean:
-Wl,-subsystem,console
-Wl,-subsystem,windows
There are equivalent options used with the compiler g++, I think they are:
-mconsole
-mwindows
In general there are many options that apply only to Windows builds, for
instance building Qt GUI applications I use these for the linker:
-Wl,-enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-as-needed
but they are not for solving linking errors, just to quiet the warnings,
and try to optimize the result.
--
René Berber
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2011-10-22 20:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-22 19:19 Philipp Kraus
2011-10-22 20:17 ` René Berber [this message]
2011-10-22 20:37 ` Philipp Kraus
2011-10-22 21:44 ` René Berber
2011-10-22 22:49 ` Philipp Kraus
2011-10-22 23:29 ` René Berber
2011-10-22 23:37 ` René Berber
2011-10-23 10:38 ` Philipp Kraus
2011-10-23 10:07 ` Philipp Kraus
2011-10-23 17:53 ` René Berber
2011-10-23 17:58 ` René Berber
2014-03-17 1:57 ` zosrothko
2014-03-17 2:28 ` Marco Atzeri
2011-10-23 18:22 ` Csaba Raduly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='j7v8c2$75o$1@dough.gmane.org' \
--to=r.berber@computer.org \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).