delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/04/07:11:03

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: mjD.OBqswBAPbVUxYJaYPvc61jLEnpq8VnBwJGdbEJOPA9xw
Message-ID: <4C306C3A.1080205@sbcglobal.net>
Date: Sun, 04 Jul 2010 11:10:50 +0000
From: Greg Chicares <gchicares AT sbcglobal DOT net>
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Building DLLs on C++ version code failed, but okay on C version code.
References: <29068199 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <29068199.post@talk.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 2010-07-04 10:24Z, kenny AT ca wrote:
> 
> $gcc -c hello.c
> $gcc -shared -o hello.dll hello.o
> 
> I successufully built it as DLL, hello.dll.

Here, the C runtime library is automatically linked.

> Then, I rewrote it in c++.
[...]
> Then, I used the commands above to built DLL, but it failed. Why did it
> fail?

Use 'g++' instead of 'gcc' for C++:

g++ -c hello.cpp
g++ -shared -o hello.dll hello.o

Then the C++ standard library is automatically linked.

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019