Compiling from source

2007-03-22
2015-02-01
  • Andrew Zhezherun

    There were a number of different threads in this forum regarding the source code of WinDjView, so I decided to put complete instructions for compiling the program.

    First of all, the version 0.4.3 can be compiled ONLY with Visual C++ v7 or v6 (Visual Studio .NET 2003, .NET or version 6 with SP6). The CVS version of WinDjView works also in the following configuration: VS 2005 Express, latest platform SDK from microsoft.com and MFC library from VC6. I have not tested WinDjView under the full version of VS 2005. If you have it installed, please share your experience.

    To build WinDjView with VS .NET or later:
    1) Navigate to the WinDjView\libdjvu folder and run the command
    nmake "UNICODE=1" "NEWCL=1"
    2) Navigate to the WinDjView folder and run the command
    nmake "UNICODE=1"
    You will need to have correct environment variables, or alternatively you can use the vsvars32.bat file.

    To build WinDjView with VC6:
    1) Navigate to the WinDjView\libdjvu folder and run the command
    nmake "UNICODE=1"
    You will need to have correct environment variables, or alternatively you can use the vcvars32.bat file.
    2) Use the project file WinDjView.dsw to build WinDjView "Release Unicode" configuration.

    The "NEWCL=1" is required for versions of VC newer than 6 (only for libdjvu makefile, since WinDjView makefile can be used only with VC7 or newer). Other options for libdjvu makefile are "UNICODE=1" (enables Unicode build - for Win2k or later, when not specified - ANSI build will be generated, probably will also work in Win98/NT4.0) and "DEBUG=1" (includes debug information, when not specified - Release configuration is build). The "UNICODE=1" option is also used for WinDjView makefile.

    Please do not ask me to supply additional project files for WinDjView or djvulibre. The included makefiles are sufficient.

     
    • MCH

      MCH - 2007-03-22

      Thanks. I try to compile the source with both MSVC 2003 and MSVC 2005. Actually, as your mentioned above, the source of the current version of WinDjview can be compiled without any problem with MSVC 2003. Though the project can also be compiled with MSVC 2005, the exectuable crashes!

       
      • Andrew Zhezherun

        Did you try to compile the CVS version with VC2005, or version 0.4.3? The crash of 0.4.3 with VC2005 is a known problem.

         
        • Nobody/Anonymous

          > The crash of 0.4.3 with VC2005 is a known problem.

          Hmm.... i write some patch to fix it...
          -------------------CUT START HERE------------------------
          3009,3010c3009,3011
          <     list<CDIB*>::iterator it;
          <     memcpy(&it, &lParam, sizeof(LPARAM));
          ---
          >     list<CDIB*>* p2dibs = reinterpret_cast<list<CDIB*>*>(lParam);
          >     list<CDIB*>::iterator it = p2dibs->begin();
          >     //memcpy(&it, &lParam, sizeof(LPARAM));
          3036c3037
          <     list<CDIB*>::iterator it = m_bitmaps.begin();
          ---
          >     //list<CDIB*>::iterator it = m_bitmaps.begin();
          3038,3040c3039,3041
          <     LPARAM lParam;
          <     VERIFY(sizeof(it) == sizeof(LPARAM));
          <     memcpy(&lParam, &it, sizeof(LPARAM));
          ---
          >     LPARAM lParam = reinterpret_cast<LPARAM>(&m_bitmaps);
          >     //VERIFY(sizeof(it) == sizeof(LPARAM));
          >     //memcpy(&lParam, &it, sizeof(LPARAM));
          --------------------CUT END HERE-----------------------------
          use pathc.exe  (can be found at http://sourceforge.net/projects/unxutils ) to apply patch.
          1)save patch to file called `patch.diff`
          2)use `patch.exe DjVuView.cpp 1.diff` command line to patch source code

          now you can compile and run 0.4.3 without crashes.
          //
          //I patch DjVuView.cpp file that have 137922 bytes size and it CRC32 = 1AE0788E
          //

          sorry for my language 8)

          mailto:jonies AT bk.ru

           
          • Nobody/Anonymous

            8) and need to patch ThumbnailsView.cpp
            -------------------------------------------------
            820,821c820,822
            <     list<CDIB*>::iterator it;
            <     memcpy(&it, &lParam, sizeof(LPARAM));
            ---
            >     list<CDIB*> *p2dibs = reinterpret_cast<list<CDIB*>*>(lParam);
            >     list<CDIB*>::iterator it = p2dibs->begin();
            >     //memcpy(&it, &lParam, sizeof(LPARAM));
            848c849
            <     list<CDIB*>::iterator it = m_bitmaps.begin();
            ---
            >     //list<CDIB*>::iterator it = m_bitmaps.begin();
            850,852c851,853
            <     LPARAM lParam;
            <     VERIFY(sizeof(it) == sizeof(LPARAM));
            <     memcpy(&lParam, &it, sizeof(LPARAM));
            ---
            >     LPARAM lParam = reinterpret_cast<LPARAM>(&m_bitmaps);
            >     //VERIFY(sizeof(it) == sizeof(LPARAM));
            >     //memcpy(&lParam, &it, sizeof(LPARAM));
            -------------------------------------------------

            mailto:jonies AT bk.ru

             
          • Andrew Zhezherun

            This issue is already fixed in the current development version of WinDjView, as I mentioned in my previous post, so this patch is no longer required. Still thank you for the your effort.

             
    • Nobody/Anonymous

      1)save patch to file called `patch.diff`
      2)use `patch.exe DjVuView.cpp patch.diff` command line to patch source code

      some errors.... )
      --
      mailto:jonies AT bk.ru

       
    • MCH

      MCH - 2007-03-27

      Great job :)

       
    • Nobody/Anonymous

      Здравствуйте!Не могу откомпилировать в VS2005:
      ------ Build started: Project: WinDjView, Configuration: Release Win32 ------
      Linking...
      LINK : fatal error LNK1181: cannot open input file 'libdjvu/libdjvu.lib'
      Build log was saved at "file://h:\WMdev\WinDjView-0.4.3\WinDjView-0.4.3\Release\BuildLog.htm"
      WinDjView - 1 error(s), 0 warning(s)
      ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
      где взять данную библиотеку?

       
      • Andrew Zhezherun

        Вся информация про компиляцию WinDjView находится в первом сообщении данной ветки.

         
    • Nobody/Anonymous

      извиняюсь, но можно узнать, что такое makefile, как его использовать и запускать.И каким образом запускать команду nmake...

       
      • Andrew Zhezherun

        makefile содержит инструкции по сборке проекта. Он считывается утилитой nmake, которая производит указанные в нём действия (компиляцию/сборку). nmake работает из командной строки.

         
    • Nobody/Anonymous

      Здравствуйте, собрал nmake'ом и makefile прект, правда с варнингами. После у меня появилась libdjvu.lib. Но при компиляции VS требует libdjvudu.lib. Переименование приводит к ошибкам.Не подскажите, что не так?

       
      • Andrew Zhezherun

        Укажите соответствующие ключи для nmake, чтобы собрать библиотеку в конфигурации (D)ebug (U)nicode (суффикс в имени файла соответствует конфигурации). См. мой первый пост.

         
    • Nobody/Anonymous

      Version 0.5 compiled with VC2005 crashes, any fix to that?

       
    • Nobody/Anonymous

      microsoft decided to make sizeof(iterator)==8 (2 pointers), for security reason, EVEN IN RELEASE MODE. in order to remove this security check, you need to define:

      /D"_SECURE_SCL=0"

      in release mode. windjview passes iterators via windows function LPARAM, which is only 4 bytes (1 pointer), which causes the crashing when casting back to iterator<>... (not very nice design!)

      it works in release mode. unfortunately i don't know how to deal with this in debug mode...

       
    • gongadze

      gongadze - 2007-08-09

      Compiling WinDjView 0.4.3 with VC++ 6.0 +SP5 succeeded!
      Compiling WinDjView 0.5 with VC++ 6.0 +SP5 failed:

      c:\Test\WinDjView-0.5\InstallDicDlg.cpp(137) : error C2065: 'BIF_USENEWUI' : undeclared identifier
      c:\Test\WinDjView-0.5\MyColorPicker.cpp(729) : error C2065: 'BS_TYPEMASK' : undeclared identifier
      c:\Test\WinDjView-0.5\SettingsDictPage.cpp(173) : error C2065: 'BIF_USENEWUI' : undeclared identifier
      c:\Test\WinDjView-0.5\WinDjView.cpp(1095) : error C2664: 'GetFileVersionInfoSizeW' : cannot convert parameter 1 from 'class CString' to 'unsigned short *'
      c:\Test\WinDjView-0.5\WinDjView.cpp(1101) : error C2664: 'GetFileVersionInfoW' : cannot convert parameter 1 from 'class CString' to 'unsigned short *'
      c:\Test\WinDjView-0.5\WinDjView.cpp(1343) : error C2065: 'CSIDL_COMMON_APPDATA' : undeclared identifier
      c:\Test\WinDjView-0.5\WinDjView.cpp(1539) : error C2065: 'CSIDL_FLAG_CREATE' : undeclared identifier

      Any Solution?

       
  • staratel20

    staratel20 - 2015-02-01

    After installing Visual Studio 2013 and try to compile version WinDjView 2.0.2. I've got error C1189: #error : MFC does not support WINVER less than 0x0501.
    Then I try to change WINVER to 0x0501, _WIN32_WINNT to 0x0501 and _WIN32_IE to 0x0500 and got 1532 errors in MyTheme.pas, all of kind:
    error C2011: 'BGTYPE' : 'enum' type redefinition

    Then I install Visual Studio 2005 , download and try to compile WinDjView 1.0.3. Compiling was success, but linking was not:
    error LNK1104: cannot open file 'libdjvu/libdjvudu.lib'

    After corrections of PATH system variable I try to create this file as was describes(who using FAR manager I advise to restart FAR after correction - long time I don't understand WTFF - Why sysTem var changing has no eFFect : ) ) with command:
    nmake "UNICODE=1" "NEWCL=1"
    and got error:
    error U1077:<Path To="" VC="">\BIN\cl.exe:return code 0xc0000135.

    Then I try to install SP1 for VS2005 and got the same error.

    That's is my experience. I'll try to solve that problems, but now - that's it.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks