Hello, I would use 7z into a routine of data transmission, but I can not use lzma SDK, I can build up more pure lzma lzmalib.c but if I try to use lib 7z.h can not compile
Has anyone had any experience with lzma to give me support.
Printable View
Hello, I would use 7z into a routine of data transmission, but I can not use lzma SDK, I can build up more pure lzma lzmalib.c but if I try to use lib 7z.h can not compile
Has anyone had any experience with lzma to give me support.
What is the compile error you get?
After you have create a new project and it adiocionei lzma920 the SDK, I have attached the directory ... / lzma920 / C / compiled and everything worked sinned after the content on the .. / lzma920/C/Util/7z/7zMain.ce include the main.cpp of my project and gave those errors that show now:
23:17:11: Running build steps for project compressfile7zsdk...
23:17:11: Configuration unchanged, skipping qmake step.
23:17:11: Starting: "D:\qt\qtcreator-2.4.0\mingw\bin\mingw32-make.exe"
D:/qt/qtcreator-2.4.0/mingw/bin/mingw32-make.exe -f Makefile.Debug
mingw32-make.exe[1]: Entering directory `D:/sistema/projetos/fonts/qt/suportware/developer/compressfile7zsdk-build-desktop-Qt_4_7_4__4_7_4w32__Debug'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\qt\4.7.4w32\include\QtCore" -I"d:\qt\4.7.4w32\include\QtGui" -I"d:\qt\4.7.4w32\include" -I"d:\qt\lzma92\C" -I"d:\qt\4.7.4w32\include\ActiveQt" -I"debug" -I"." -I"..\compressfile7zsdk" -I"." -I"d:\qt\4.7.4w32\mkspecs\win32-g++" -o debug\main.o ..\compressfile7zsdk\main.cpp
..\compressfile7zsdk\main.cpp: In function 'SRes Utf16_To_Char(CBuf*, const UInt16*, int)':
..\compressfile7zsdk\main.cpp:121: error: invalid conversion from 'const UInt16*' to 'const WCHAR*'
..\compressfile7zsdk\main.cpp:121: error: initializing argument 3 of 'int WideCharToMultiByte(UINT, DWORD, const WCHAR*, int, CHAR*, int, const CHAR*, BOOL*)'
..\compressfile7zsdk\main.cpp: In function 'WRes MyCreateDir(const UInt16*)':
..\compressfile7zsdk\main.cpp:138: error: invalid conversion from 'const UInt16*' to 'const WCHAR*'
..\compressfile7zsdk\main.cpp:138: error: initializing argument 1 of 'BOOL CreateDirectoryW(const WCHAR*, _SECURITY_ATTRIBUTES*)'
..\compressfile7zsdk\main.cpp: In function 'WRes OutFile_OpenUtf16(CSzFile*, const UInt16*)':
..\compressfile7zsdk\main.cpp:163: error: invalid conversion from 'const UInt16*' to 'const WCHAR*'
..\compressfile7zsdk\main.cpp:163: error: initializing argument 2 of 'WRes OutFile_OpenW(CSzFile*, const WCHAR*)'
mingw32-make.exe[1]: Leaving directory `D:/sistema/projetos/fonts/qt/suportware/developer/compressfile7zsdk-build-desktop-Qt_4_7_4__4_7_4w32__Debug'
..\compressfile7zsdk\main.cpp: At global scope:
..\compressfile7zsdk\main.cpp:134: warning: 'WRes MyCreateDir(const UInt16*)' defined but not used
..\compressfile7zsdk\main.cpp:160: warning: 'WRes OutFile_OpenUtf16(CSzFile*, const UInt16*)' defined but not used
..\compressfile7zsdk\main.cpp:175: warning: 'SRes PrintString(const UInt16*)' defined but not used
..\compressfile7zsdk\main.cpp:187: warning: 'void UInt64ToStr(UInt64, char*)' defined but not used
..\compressfile7zsdk\main.cpp:223: warning: 'void ConvertFileTimeToString(const CNtfsFileTime*, char*)' defined but not used
..\compressfile7zsdk\main.cpp:268: warning: 'void GetAttribString(UInt32, Bool, char*)' defined but not used
mingw32-make.exe[1]: *** [debug/main.o] Error 1
mingw32-make.exe: *** [debug] Error 2
23:17:12: The process "D:\qt\qtcreator-2.4.0\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project compressfile7zsdk (target: Desktop)
When executing build step 'Make'
Can anyone understand what this text actually says??Quote:
After you have create a new project and it adiocionei lzma920 the SDK, I have attached the directory ... / lzma920 / C / compiled and everything worked sinned after the content on the .. / lzma920/C/Util/7z/7zMain.ce include the main.cpp of my project and gave those errors that show now:
post your mail.cpp - it seems you have include problems.
Sorry, my language is Portuguese-Brazil and google is not translated correctly into English.
The problem was solved.
It was created compress and decompress based on "main2" "lzmautil.c"
#Now just call the main current projectCode:
int compress(char *inFileName,char *outFileName) { char rs[800] = { 0 }; CFileSeqInStream inStream; CFileOutStream outStream; int res; FileSeqInStream_CreateVTable(&inStream); File_Construct(&inStream.file); FileOutStream_CreateVTable(&outStream); File_Construct(&outStream.file); { size_t t4 = sizeof(UInt32); size_t t8 = sizeof(UInt64); if (t4 != 4 || t8 != 8) return PrintError(rs, "Incorrect UInt32 or UInt64"); } if (InFile_Open(&inStream.file, inFileName) != 0) return PrintError(rs, "Can not open input file"); if (OutFile_Open(&outStream.file, outFileName ) != 0) return PrintError(rs, "Can not open output file"); UInt64 fileSize; File_GetLength(&inStream.file, &fileSize); res = Encode(&outStream.s, &inStream.s, fileSize, rs); File_Close(&outStream.file); File_Close(&inStream.file); if (res != SZ_OK) { if (res == SZ_ERROR_MEM) return PrintError(rs, kCantAllocateMessage); else if (res == SZ_ERROR_DATA) return PrintError(rs, kDataErrorMessage); else if (res == SZ_ERROR_WRITE) return PrintError(rs, kCantWriteMessage); else if (res == SZ_ERROR_READ) return PrintError(rs, kCantReadMessage); return PrintErrorNumber(rs, res); } return 0; } int Decompress(char *inFileName,char *outFileName) { char rs[800] = { 0 }; CFileSeqInStream inStream; CFileOutStream outStream; int res; //Bool useOutFile = False; FileSeqInStream_CreateVTable(&inStream); File_Construct(&inStream.file); FileOutStream_CreateVTable(&outStream); File_Construct(&outStream.file); size_t t4 = sizeof(UInt32); size_t t8 = sizeof(UInt64); if (t4 != 4 || t8 != 8) return PrintError(rs, "Incorrect UInt32 or UInt64"); if (InFile_Open(&inStream.file, inFileName) != 0) return PrintError(rs, "Can not open input file"); if (OutFile_Open(&outStream.file, outFileName) != 0) return PrintError(rs, "Can not open output file"); res = Decode(&outStream.s, &inStream.s); File_Close(&outStream.file); File_Close(&inStream.file); if (res != SZ_OK) { if (res == SZ_ERROR_MEM) return PrintError(rs, kCantAllocateMessage); else if (res == SZ_ERROR_DATA) return PrintError(rs, kDataErrorMessage); else if (res == SZ_ERROR_WRITE) return PrintError(rs, kCantWriteMessage); else if (res == SZ_ERROR_READ) return PrintError(rs, kCantReadMessage); return PrintErrorNumber(rs, res); } return 0; }
Code:
#include "lzma920/C/Util/Lzma/LzmaUtil.c" int main(int argc, char *argv[]) { //MainWindow w; //w.show(); char *inFileName="c:/dbforcacad001.db"; char *outFileName="c:/dbforcacad001.lzma"; compress(inFileName,outFileName); inFileName=outFileName; outFileName="c:/dbforcacad001.lzma.db"; Decompress(inFileName,outFileName); //return a.exec(); }