Using LZMA SDK in C ++

I am trying to use the LZMA SDK to compress a file in my program. I downloaded the SDK, but I do not know how to use it. Can someone tell me what steps I need to take to make this work? Any help would be greatly appreciated

I am almost new to the world of C and C ++

+4
source share
2 answers

I also had to use 7zip in one of my programs, and found the LZMA SDK a bit more complex than I expected before. So I started using the simplified C ++ shell here . This is currently Windows-only, but if your platform might be useful.

+6
source

As a general answer to this question, to make any sdk work, you need to do three things:

  • #include appropriate headers in your source so that the compiler can verify that you have used the correct functions, and the linker knows which characters you are referring to.
  • Tell the compiler where your header files are. You can do this with gcc using gcc -I/path/to/header/dir .
  • Tell the linker where the lib files should be, which should be compiled and include them. Again, using gcc, you do this with gcc -L/path/to/library/dir , and you give gcc (well, ld) a link to a specific library with gcc -lnamewithoutlibprefix (lowercase l).

As an example for the library, I use a lot, MPIR, against the / opt tree, I could compile like this:

 gcc -I/opt/include -L/opt/lib -lmpir myprog.c -o myprog 

This is just an example and very specific to Linux. In truth, MPIR is installed in / usr, and I don't need to do this, I just pick it up as an example here.

For Windows, take a look at cl / I and LINK.EXE Options .

Of course, you can automate this process in different development environments. Visual Studio, for example, will create the correct command lines for you if you fill in the correct dialog boxes. So I believe that Eclipse and I know that Dev / C ++ can also.

+4
source

Source: https://habr.com/ru/post/1304675/


All Articles