User forums > Using Code::Blocks
Using libxlsxwriter : how to use -lz
Miguel Gimenez:
msys should use the same toolchain of step 1, you can use gcc --version to check which version msys and cmd are using. Try msys-1.0 from this link:
http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
bonelli:
Msys 1 installed, binded to C:/MinGW using etc/fstab
gcc -- version returns 9.2.0, using cmd or msys
--- Quote ---Then you can copy libz.a to the libxlsxwriter folder
--- End quote ---
> Done
--- Quote ---To compile libxlxwriter open msys, go to the library's source folder and execute "make".
--- End quote ---
--- Code: ---$ make
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/minizip'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/minizip'
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/tmpfileplus'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/tmpfileplus'
make[1]: Entering directory `/d/soft/lib/xlsx/third_party/md5'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/d/soft/lib/xlsx/third_party/md5'
make[1]: Entering directory `/d/soft/lib/xlsx/src'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libxlsxwriter.dll] Error 1
make[1]: Leaving directory `/d/soft/lib/xlsx/src'
make: *** [all] Error 2
--- End code ---
Note:
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin
is
C:\MinGW\mingw32\bin
I don't know why it didn't use the ld.exe in C:\MinGW\bin
Sounds like they like spaghetti.
Miguel Gimenez:
Try copying libz.a into "/d/soft/lib/xlsx/src" and run make again. My MinGW installation (MinGW-w64) has a built-in libz.a, so this step is not needed.
bonelli:
I already did that, but the lib is still not found. Any way to specify where the lib is using the command line?
bonelli:
--- Code: ---make LDFLAGS="-L."
--- End code ---
did the job. :)
How do you do to take care of the global variables? I didn't see where in your project you are asking to use global variables.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version