Compiling error "cannot find -..."

New to FreeBASIC? Post your questions here.
Post Reply
N3trunn3r
Posts: 110
Joined: Feb 14, 2008 15:48

Compiling error "cannot find -..."

Post by N3trunn3r »

I'm having trouble compiling without ld telling me: "cannot find -...". For example "cannot find -lz". I get the same error with cairo and freetype2.

I'm compiling a program that worked with version 0.21.1. I know there have been made many changes with the latest version so I'm expecting some errors. My version now is 1.05.0

I have zlib1.dll in the same folder as the .exe
The liblz32.dll.a exists in the \lib\win64 folder.
My program uses: #Include Once "zlib.bi"
I compile under Win7x64 with "fbc icon.rc -exx Template.bas -x Template.exe".

I searched the forum but only found library creation related topics.
Should I use -lib or -l in some way I dont' know?
What am I missing here?
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Compiling error "cannot find -..."

Post by dodicat »

If you look in zlib.bi you will see this is where the library is actually called
#inclib z
So it looks for libz.a or libz.dll or libz.dll.a
or z.dll

You have zlib1.dll
This would be

#inclib "zlib1"

in the zlib.bi file

And copy this include file into the same folder as your zlib.dll and source code and icon file and resource file.
Also, although I haven't tested, perhaps rename the resource file to fbcicon.rc, to omit the space.
It might do perfectly well with a space,but, as I say, I haven't tested.
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Compiling error "cannot find -..."

Post by fxm »

N3trunn3r wrote:I'm having trouble compiling without ld telling me: "cannot find -...". For example "cannot find -lz". I get the same error with cairo and freetype2.

I'm compiling a program that worked with version 0.21.1. I know there have been made many changes with the latest version so I'm expecting some errors. My version now is 1.05.0
A lot of third-party libraries were compiled up to the 0.90.1 release, then no more after.

Links to find the last compiled libraries:
http://sourceforge.net/projects/fbc/fil ... Libraries/
http://sourceforge.net/projects/fbc/fil ... Libraries/
N3trunn3r
Posts: 110
Joined: Feb 14, 2008 15:48

Re: Compiling error "cannot find -..."

Post by N3trunn3r »

I tried using the old precompiled libz.a file and I got the following error:
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: skipping incompatible C:\Program Files\FreeBasic\lib\win64/libz.a when searching for -lz
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: skipping incompatible C:\Program Files\FreeBasic\lib\win64\libz.a when searching for -lz
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: skipping incompatible C:\Program Files\FreeBasic\lib\win64/libz.a when searching for -lz
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: cannot find -lz
I tried the DLL of the same version as specified in zlib.bi, similar error:
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: skipping incompatible ./libz.dll when searching for -lz
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: skipping incompatible ./libz.dll when searching for -lz
C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe: cannot find -lz
Why is this not working?
Is there a good tutorial how I can compile the library myself? Create the .a file?
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Compiling error "cannot find -..."

Post by fxm »

Do you compile in fbc 32-bit?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Compiling error "cannot find -..."

Post by D.J.Peters »

fxm wrote:Do you compile in fbc 32-bit?
no he use 64-bit C:\PROGRA~1\FREEBA~1\bin\win64\ld.exe:
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Compiling error "cannot find -..."

Post by St_W »

You can't mix 32-bit and 64-bit libraries. A 32-bit application can only use 32-bit libraries and a 64-bit application can only use 64-bit libraries.

You can find a pre-compiled version of libz for 32/64 bit e.g. here:
http://users.freebasic-portal.de/stw/fi ... b-1211.zip

It includes both a static (.a) and dynamic (.dll.a + .dll) build of the library.
N3trunn3r
Posts: 110
Joined: Feb 14, 2008 15:48

Re: Compiling error "cannot find -..."

Post by N3trunn3r »

Ah thanks everybody for the help. Now it works fine! :) stupid mistake using x64 on x32 libraries.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Compiling error "cannot find -..."

Post by dodicat »

Hee Hee!
You got us all raised blood pressure.
Post Reply