This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: permission denied for g++ with shared library


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]