locked
Use zlib in a Window Runtime Component RRS feed

  • Question

  • I created a Windows Store App c# in Visual Studio 12. There, I need to use native C++ code that uses minizip and zlib.

    To use the native C++ code I created a Windows Runtime Component (http://msdn.microsoft.com/en-us/library/windows/apps/hh755833.aspx). It works. I compiled zlib in Visual Studio (http://stackoverflow.com/questions/10507893/libzip-with-visual-studio-2010), but I don't know how can I use

    #include <zlib>

    in a c file in my Windows Runtime Component Proyect.

    I saw that I can install zlib.net NuGet with the Manager, in VS. But the same...

    Thanks!
    Friday, October 25, 2013 3:14 PM

Answers

  • You will need to recompile with Visual Studio 2012 (for a Windows 8 app) or 2013 (for a Windows 8.1 app).

    Are you including zlib.h in your project? It sounds like you don't have it somewhere visible to the app.

    --Rob

    Tuesday, October 29, 2013 8:09 PM
    Moderator

All replies

  • Can you explain what you are having a problem with regarding #include <zlib>?

    Is the problem including zlib at all? Or is it specific to using a Windows Runtime Component? Are you compiling zlib compatible with Windows Store apps (see Win32 and COM APIs)? I assume you're not compiling it with Visual Studio 2010.

    --Rob

    Saturday, October 26, 2013 1:57 AM
    Moderator
  • Hi,

    I compilet it with Visual Studio 2011 with this tutorial http://stackoverflow.com/questions/10507893/libzip-with-visual-studio-2010.

    I only need to use the zlib functions in my Windows Runtime Component, but I don't know how can "reference" the zlib proyect, or a zlib dll file or something.

    So, in a cpp file in the Windows Runtime Component I need to use

    #include <zlib>

    // Class1.cpp
    #include "pch.h"
    #include "Class1.h"
    
    using namespace MyWindowsRuntimeComponent;
    using namespace Platform;
    
    #include <zlib.h> //cannot open source file zlib
    
    Class1::Class1()
    {
    }
    
    bool Class1::unzip(char* file) {
    	unzFile zip = unzOpen(file); //need to call this function
    	//...
    }

    Tuesday, October 29, 2013 11:48 AM
  • You will need to recompile with Visual Studio 2012 (for a Windows 8 app) or 2013 (for a Windows 8.1 app).

    Are you including zlib.h in your project? It sounds like you don't have it somewhere visible to the app.

    --Rob

    Tuesday, October 29, 2013 8:09 PM
    Moderator