Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #66976 > unrolled thread

minGW problem - linking

Started bybilsch <bilsch01@gmail.com>
First post2015-08-07 14:45 -0700
Last post2015-08-08 16:07 -0700
Articles 8 — 6 participants

Back to article view | Back to comp.lang.c


Contents

  minGW problem - linking bilsch <bilsch01@gmail.com> - 2015-08-07 14:45 -0700
    minGW problem - linking "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-07 17:53 -0700
      Re: minGW problem - linking bilsch <bilsch01@gmail.com> - 2015-08-07 18:56 -0700
    Re: minGW problem - linking Lőrinczy Zsigmond <nospam@for.me> - 2015-08-08 06:37 +0200
      Re: minGW problem - linking bilsch <bilsch01@gmail.com> - 2015-08-07 23:40 -0700
      Re: minGW problem - linking Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-08-08 10:27 +0200
    Re: minGW problem - linking James Kuyper <jameskuyper@verizon.net> - 2015-08-08 11:28 -0400
      Re: minGW problem - linking bilsch01 <king621@comcast.net> - 2015-08-08 16:07 -0700

#66976 — minGW problem - linking

Frombilsch <bilsch01@gmail.com>
Date2015-08-07 14:45 -0700
SubjectminGW problem - linking
Message-ID<mq38qh$mvs$1@dont-email.me>
I have a program I developed on a Ubuntu machine using gcc compiler and 
I want to modify it to rum on Win7.  The program uses SDL for graphics 
and ncurses for UI.  I installed minGW because it has gcc that runs in 
Windows and also because the SDL site offers SDL libraries and header 
files for minGW.  I also got a curses package for Windows. The compiler 
found several incompatibilities between my program and curses - which I 
successfully fixed.  Now the linker errors show up.  ld.exe cannot find 
the libraries for SDL and curses - no matter how I write the linker 
options on the command line.  For instance if I write the library file 
path prefixed with capital -L then followed by library file name 
prefixed with low case -l. Or write the whole path and file name 
together prefixed with low case -l.  Or if I copy the library files into 
the build directory and simply write -lSDL2.dll as the link option with 
no path.  Nothing works.  Here's a typical error message:

C:/Program 
Files/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
cannot find -lC:\Users\Owner\SDL2-2.0.3\lib\x64\SDL.dll

Also I don't understand why the /../../ in the message.  The location of 
ld.exe is simply C:/Program Files/mingw/mingw64/bin.

TIA.    Bill S.

[toc] | [next] | [standalone]


#66982

From"Rick C. Hodgin" <rick.c.hodgin@gmail.com>
Date2015-08-07 17:53 -0700
Message-ID<da5233f5-17aa-41b9-9b5b-a16d8916821a@googlegroups.com>
In reply to#66976
Are you compiling for 32-bit or 64-bit?

Best regards,
Rick C. Hodgin

[toc] | [prev] | [next] | [standalone]


#66985

Frombilsch <bilsch01@gmail.com>
Date2015-08-07 18:56 -0700
Message-ID<mq3ngj$qqh$1@dont-email.me>
In reply to#66982
On 8/7/2015 5:53 PM, Rick C. Hodgin wrote:
> Are you compiling for 32-bit or 64-bit?
>
> Best regards,
> Rick C. Hodgin
>

64-bit. I know that mingw32 looks strange but that is the directory 
structure for the 64 bit version.

[toc] | [prev] | [next] | [standalone]


#66986

FromLőrinczy Zsigmond <nospam@for.me>
Date2015-08-08 06:37 +0200
Message-ID<mq412f$a0s$1@speranza.aioe.org>
In reply to#66976
Use the syntax gcc expects:
     gcc -o myexe.exe myexe.o -LC:\Users\Owner\SDL2-2.0.3\lib\x64 -lSDL2

Or specify the dll in itself:
     gcc -o myexe.exe myexe.o C:\Users\Owner\SDL2-2.0.3\lib\x64\SDL2.dll

[toc] | [prev] | [next] | [standalone]


#66991

Frombilsch <bilsch01@gmail.com>
Date2015-08-07 23:40 -0700
Message-ID<mq4873$l3v$1@dont-email.me>
In reply to#66986
On 8/7/2015 9:37 PM, Lőrinczy Zsigmond wrote:
> Use the syntax gcc expects:
>      gcc -o myexe.exe myexe.o -LC:\Users\Owner\SDL2-2.0.3\lib\x64 -lSDL2
>
> Or specify the dll in itself:
>      gcc -o myexe.exe myexe.o C:\Users\Owner\SDL2-2.0.3\lib\x64\SDL2.dll
>
OK. The bare file name by itself works.  Thanks.

[toc] | [prev] | [next] | [standalone]


#66997

FromLőrinczy Zsigmond <zsiga@nospam.for.me>
Date2015-08-08 10:27 +0200
Message-ID<mq4eki$3dr$1@speranza.aioe.org>
In reply to#66986
> Or specify the dll in itself:
> gcc -o myexe.exe myexe.o C:\Users\Owner\SDL2-2.0.3\lib\x64\SDL2.dll

Note: Using filenames like SDL2-2.0.3\lib\x64 is not very portable
(e.g. you might change versions later).

Programs like 'junction' or 'mklink' can create symlinks
that make this a bit more elegant:

cd \users\owner
mklink /d sdl2 sdl2-2.0.3
cd sdl2
mklink /d lib64 lib\x64
...
gcc -o myexe.exe myexe.o C:\Users\Owner\SDL2\lib64\SDL2.dll

[toc] | [prev] | [next] | [standalone]


#67003

FromJames Kuyper <jameskuyper@verizon.net>
Date2015-08-08 11:28 -0400
Message-ID<55C6201D.5000808@verizon.net>
In reply to#66976
On 08/07/2015 05:45 PM, bilsch wrote:
> I have a program I developed on a Ubuntu machine using gcc compiler and 
> I want to modify it to rum on Win7.  The program uses SDL for graphics 
> and ncurses for UI.  I installed minGW because it has gcc that runs in 
> Windows and also because the SDL site offers SDL libraries and header 
> files for minGW.  I also got a curses package for Windows. The compiler 
> found several incompatibilities between my program and curses - which I 
> successfully fixed.  Now the linker errors show up.  ld.exe cannot find 
> the libraries for SDL and curses - no matter how I write the linker 
> options on the command line.  For instance if I write the library file 
> path prefixed with capital -L then followed by library file name 
> prefixed with low case -l. Or write the whole path and file name 
> together prefixed with low case -l.  Or if I copy the library files into 
> the build directory and simply write -lSDL2.dll as the link option with 
> no path.  Nothing works.  Here's a typical error message:
> 
> C:/Program 
> Files/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
> cannot find -lC:\Users\Owner\SDL2-2.0.3\lib\x64\SDL.dll
> 
> Also I don't understand why the /../../ in the message.  The location of 
> ld.exe is simply C:/Program Files/mingw/mingw64/bin.

Path names like that occur on Unix-like systems as the result of
symbolic links containing ../ sequences, which mean "go up one level in
the directory tree". I'm not sufficiently familiar with Win7 to be sure
whether it behaves similarly. However, the use of the forward slash
instead of the backslash suggests that the message may be being printed
by a program that treats the Win7 file system as if it were a Unix-like
one. On a Unix-like system, one way to get such a message would be if:

/Program Files/mingw/mingw64/bin/ld.exe is a symbolic link to
../lib/gcc/x86_64-w64-mingw32/5.1.0/ld.exe, or, equivalently,
/Program Files/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/5.1.0/ld.exe

That, in turn, is a symbolic link to
../../../../x86_64-w64-mingw32/bin/ld.exe, or, equivalently,
/Program Files/mingw/mingw64/x86_64-w64-mingw32/bin/ld.exe

[toc] | [prev] | [next] | [standalone]


#67016

Frombilsch01 <king621@comcast.net>
Date2015-08-08 16:07 -0700
Message-ID<mq6215$8e8$1@dont-email.me>
In reply to#67003
On 08/08/2015 08:28 AM, James Kuyper wrote:
> On 08/07/2015 05:45 PM, bilsch wrote:
>> I have a program I developed on a Ubuntu machine using gcc compiler and
>> I want to modify it to rum on Win7.  The program uses SDL for graphics
>> and ncurses for UI.  I installed minGW because it has gcc that runs in
>> Windows and also because the SDL site offers SDL libraries and header
>> files for minGW.  I also got a curses package for Windows. The compiler
>> found several incompatibilities between my program and curses - which I
>> successfully fixed.  Now the linker errors show up.  ld.exe cannot find
>> the libraries for SDL and curses - no matter how I write the linker
>> options on the command line.  For instance if I write the library file
>> path prefixed with capital -L then followed by library file name
>> prefixed with low case -l. Or write the whole path and file name
>> together prefixed with low case -l.  Or if I copy the library files into
>> the build directory and simply write -lSDL2.dll as the link option with
>> no path.  Nothing works.  Here's a typical error message:
>>
>> C:/Program
>> Files/mingw/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
>> cannot find -lC:\Users\Owner\SDL2-2.0.3\lib\x64\SDL.dll
>>
>> Also I don't understand why the /../../ in the message.  The location of
>> ld.exe is simply C:/Program Files/mingw/mingw64/bin.
>
> Path names like that occur on Unix-like systems as the result of
> symbolic links containing ../ sequences, which mean "go up one level in
> the directory tree". I'm not sufficiently familiar with Win7 to be sure
> whether it behaves similarly. However, the use of the forward slash
> instead of the backslash suggests that the message may be being printed
> by a program that treats the Win7 file system as if it were a Unix-like
> one. On a Unix-like system, one way to get such a message would be if:
>
> /Program Files/mingw/mingw64/bin/ld.exe is a symbolic link to
> ../lib/gcc/x86_64-w64-mingw32/5.1.0/ld.exe, or, equivalently,
> /Program Files/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/5.1.0/ld.exe
>
> That, in turn, is a symbolic link to
> ../../../../x86_64-w64-mingw32/bin/ld.exe, or, equivalently,
> /Program Files/mingw/mingw64/x86_64-w64-mingw32/bin/ld.exe
>
Thanks

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web