Results 1 to 5 of 5

Thread: How to use LZMA SDK to create 7z

  1. #1
    Join Date
    Nov 2011
    Location
    Brasil, são luiz
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default How to use LZMA SDK to create 7z

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to use LZMA SDK to create 7z

    What is the compile error you get?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2011
    Location
    Brasil, são luiz
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use LZMA SDK to create 7z

    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'

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to use LZMA SDK to create 7z

    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:
    Can anyone understand what this text actually says??

    post your mail.cpp - it seems you have include problems.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Nov 2011
    Location
    Brasil, são luiz
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use LZMA SDK to create 7z

    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"

    Qt Code:
    1. int compress(char *inFileName,char *outFileName)
    2. {
    3.  
    4. char rs[800] = { 0 };
    5. CFileSeqInStream inStream;
    6. CFileOutStream outStream;
    7. int res;
    8.  
    9. FileSeqInStream_CreateVTable(&inStream);
    10. File_Construct(&inStream.file);
    11.  
    12. FileOutStream_CreateVTable(&outStream);
    13. File_Construct(&outStream.file);
    14.  
    15. {
    16. size_t t4 = sizeof(UInt32);
    17. size_t t8 = sizeof(UInt64);
    18. if (t4 != 4 || t8 != 8)
    19. return PrintError(rs, "Incorrect UInt32 or UInt64");
    20. }
    21.  
    22. if (InFile_Open(&inStream.file, inFileName) != 0)
    23. return PrintError(rs, "Can not open input file");
    24.  
    25. if (OutFile_Open(&outStream.file, outFileName ) != 0)
    26. return PrintError(rs, "Can not open output file");
    27.  
    28.  
    29. UInt64 fileSize;
    30. File_GetLength(&inStream.file, &fileSize);
    31. res = Encode(&outStream.s, &inStream.s, fileSize, rs);
    32.  
    33. File_Close(&outStream.file);
    34. File_Close(&inStream.file);
    35.  
    36. if (res != SZ_OK)
    37. {
    38. if (res == SZ_ERROR_MEM)
    39. return PrintError(rs, kCantAllocateMessage);
    40. else if (res == SZ_ERROR_DATA)
    41. return PrintError(rs, kDataErrorMessage);
    42. else if (res == SZ_ERROR_WRITE)
    43. return PrintError(rs, kCantWriteMessage);
    44. else if (res == SZ_ERROR_READ)
    45. return PrintError(rs, kCantReadMessage);
    46. return PrintErrorNumber(rs, res);
    47. }
    48. return 0;
    49. }
    50.  
    51. int Decompress(char *inFileName,char *outFileName)
    52. {
    53. char rs[800] = { 0 };
    54. CFileSeqInStream inStream;
    55. CFileOutStream outStream;
    56. int res;
    57. //Bool useOutFile = False;
    58.  
    59. FileSeqInStream_CreateVTable(&inStream);
    60. File_Construct(&inStream.file);
    61.  
    62. FileOutStream_CreateVTable(&outStream);
    63. File_Construct(&outStream.file);
    64.  
    65. size_t t4 = sizeof(UInt32);
    66. size_t t8 = sizeof(UInt64);
    67. if (t4 != 4 || t8 != 8)
    68. return PrintError(rs, "Incorrect UInt32 or UInt64");
    69.  
    70. if (InFile_Open(&inStream.file, inFileName) != 0)
    71. return PrintError(rs, "Can not open input file");
    72.  
    73.  
    74. if (OutFile_Open(&outStream.file, outFileName) != 0)
    75. return PrintError(rs, "Can not open output file");
    76.  
    77.  
    78.  
    79. res = Decode(&outStream.s, &inStream.s);
    80.  
    81. File_Close(&outStream.file);
    82. File_Close(&inStream.file);
    83.  
    84. if (res != SZ_OK)
    85. {
    86. if (res == SZ_ERROR_MEM)
    87. return PrintError(rs, kCantAllocateMessage);
    88. else if (res == SZ_ERROR_DATA)
    89. return PrintError(rs, kDataErrorMessage);
    90. else if (res == SZ_ERROR_WRITE)
    91. return PrintError(rs, kCantWriteMessage);
    92. else if (res == SZ_ERROR_READ)
    93. return PrintError(rs, kCantReadMessage);
    94. return PrintErrorNumber(rs, res);
    95. }
    96. return 0;
    97. }
    To copy to clipboard, switch view to plain text mode 
    #Now just call the main current project

    Qt Code:
    1. #include "lzma920/C/Util/Lzma/LzmaUtil.c"
    2.  
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. //MainWindow w;
    8. //w.show();
    9.  
    10. char *inFileName="c:/dbforcacad001.db";
    11. char *outFileName="c:/dbforcacad001.lzma";
    12.  
    13. compress(inFileName,outFileName);
    14.  
    15. inFileName=outFileName;
    16. outFileName="c:/dbforcacad001.lzma.db";
    17.  
    18. Decompress(inFileName,outFileName);
    19.  
    20.  
    21. //return a.exec();
    22. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 7th March 2012 at 08:38.

Similar Threads

  1. How to Create lib in Qt.
    By shyam prasad in forum Qt Programming
    Replies: 6
    Last Post: 14th August 2012, 10:02
  2. Qt in VS does not create an .exe
    By Nazgul in forum Installation and Deployment
    Replies: 7
    Last Post: 14th August 2012, 09:34
  3. Replies: 4
    Last Post: 1st May 2009, 11:00
  4. How to create a SDK?
    By blackfox in forum Qt Programming
    Replies: 0
    Last Post: 10th September 2008, 10:23
  5. how to create pop-ups
    By miguel_mark in forum Newbie
    Replies: 1
    Last Post: 22nd October 2007, 06:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.