Pelles C forum

Pelles C => General discussions => Topic started by: GaborK on November 17, 2019, 09:58:59 PM

Title: How to compile libzip
Post by: GaborK on November 17, 2019, 09:58:59 PM
I would like to compile libzip for Pelles C in Windows 7. I downloaded libzip from https://libzip.org/download/libzip-1.5.2.tar.gz, and I tried to install it, following the instructions in INSTALL.md. For that reason,
The output is below:

Quote
CMake Error at C:/Program Files/cmake-3.16.0-rc3-win64-x64/share/cmake-3.16/Modules/CMakeDetermineCCompiler.cmake:49 (message):
  Could not find compiler set in environment variable CC:

  C:\Program Files\PellesC\Bin.
Call Stack (most recent call first):
  CMakeLists.txt:8 (PROJECT)

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/[......]/build/CMakeFiles/CMakeOutput.log".

Could you please give me step by step instructions on how to compile libzip, and arrange that I can use libzip functions in my C code?
Title: Re: How to compile libzip
Post by: frankie on November 18, 2019, 05:10:04 PM
The environment variables must be set globally, not in a CMD window, in which case the settings would be only local to the current consolle.
In any case PellesC don't works well with cMake, even command switch could be conflicting with those of GCC.
The correct way is to expand source files in a directory and then build an IDE project adding the necessary files.
If a VC project is present you can use the wizard to import it in a PellesC project.
Title: Re: How to compile libzip
Post by: GaborK on November 18, 2019, 09:21:34 PM
Thank you for the reply.
I set the environment variables globally, in the Control Panel. If I open a Command Prompt, the output of
Code: [Select]
echo %PATH% is always correct.
Could you please elaborate a bit more on
Actually, I created a new "Win64 Static Library (LIB)" project, and I tried to add *.c files to it from the unzipped folder, using 'Project -> Add files to project...' but an error message appeared:
Quote
Unable to add '*.c' to the project. Unknown file extension, or invalid directory.
I found it rather strange because files with .c extension are listed in the pop-up window by default.
I also tried adding the <path to the unzipped folder> to the "Includes" in the 'Project -> Project options... -> Folders tab' but it didn't solve my problem either. At runtime, a lot of error messages appeared about zip.h.
Pleaseee try to be a bit more specific, I am a beginner at Pelles C.
Title: Re: How to compile libzip
Post by: frankie on November 19, 2019, 11:07:19 AM
Normally tou should know what you want build, a library, static or dynamic, or an exe.
The info about what file you need could be found inside makefiles (or cmake files).
I'm a little bit busy myself, if you can wait I'll have a look.
Title: Re: How to compile libzip
Post by: John Z on November 29, 2019, 01:51:18 PM
Would you consider using another ZIP library?  I've used miniz in PellesC windows 7 version 8.00, and now windows 10 PellesC version 9.00 - it is quite easy, only three files to add to your existing project. I got it from here https://github.com/richgel999/miniz.  Just added two .h files and one zip.c to my program.  I looked at libzip, and many others too, but went with this one as being much easier to implement.