delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/21/22:05:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49EE7DCF.1050106@gmail.com>
Date: Wed, 22 Apr 2009 03:15:43 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: permission denied for g++ with shared library
References: <23166858 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <23166858.post@talk.nabble.com>
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

bigsnail wrote:

> When I compile a hello.cpp like below using 
> g++ -shared -o hello hello.cpp
> It successfully compiles but when I run ./hello, it complains:
> -bash: ./hello: Permission denied

> If I compile by "g++ -o hello hello.cpp", it runs well.

  "-shared" doesn't mean what you think it means.  It's not the opposite of
"-static":

-static => link against runtime static libs, not DLLs.

<nothing, default>
        => link against runtime DLLs, not static libs


-shared => compile this application as a DLL, not an exe!


    cheers,
      DaveK


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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