Menu

Notepad 5.03 source not compile cleanly MinGW

NoAngel
2008-08-08
2012-11-13
  • NoAngel

    NoAngel - 2008-08-08

    Problem:
    Downloaded Notepad++ 5.03 source code (http://internap.dl.sourceforge.net/sourceforge/notepad-plus/npp.5.0.3.src.zip) and tried to compile with stable MinGW compiler(gcc --version --> "gcc (GCC) 3.4.5 (mingw-vista special r3)", g++ --version "g++ (GCC) 3.4.5 (mingw-vista special r3)").

    Compiler logs:
    PATH=[...];C:\WINNT\system
    32;C:\WINNT;C:\WINNT\System32\Wbem;[...];C:\Dev-Cpp\bin;C:
    \Dev-Cpp\libexec\gcc\mingw32\3.4.5;C:\Dev-Cpp\lib;C:\Dev-Cpp\include
    --
    cd [...]\Notepad++_build_root\scintilla\win32
    mingw32-make
    [...]
    g++ -DNDEBUG -Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -I ../incl
    ude -I ../src -Os -fno-exceptions  -fno-rtti -mno-cygwin -c ../src/LexSearchResu
    lt.cxx
    ../src/LexSearchResult.cxx:47: error: extra `;'
    ../src/LexSearchResult.cxx:57: error: extra `;'
    mingw32-make: *** [LexSearchResult.o] Error 1
    /*ok, it's easy to fix here*/
    src/LexSearchResult.cxx changes:
    d47 1
    a47 1
    }/*;*/
    d57 1
    a57 1
    }/*;*/
    --
    mingw32-make
    bin/SciLexer.dll built OK
    --
    cd [...]\PowerEditor\gcc
    mingw32-make
    [...]
    g++ -include./include/various.h -I../src -I../src/WinControls -I../src/WinContro
    ls/AboutDlg -I../src/WinControls/ContextMenu -I../src/WinControls/ColourPicker -
    I../src/WinControls/DockingWnd -I../src/WinControls/Grid -I../src/WinControls/Im
    ageListSet -I../src/WinControls/OpenSaveFileDialog -I../src/WinControls/Preferen
    ce -I../src/WinControls/shortcut -I../src/WinControls/SplitterContainer -I../src
    /WinControls/StaticDialog -I../src/WinControls/StaticDialog/RunDlg -I../src/WinC
    ontrols/StatusBar -I../src/WinControls/TabBar -I../src/WinControls/TaskList -I..
    /src/WinControls/ToolBar -I../src/WinControls/ToolTip -I../src/WinControls/TrayI
    con -I../src/WinControls/TreeView -I../src/WinControls/WindowsDlg -I../src/TinyX
    ml -I../src/ScitillaComponent -I../src/MISC -I../src/MISC/Exception -I../src/MIS
    C/PluginsManager -I../src/MISC/Process -I../src/MISC/RegExt -I../src/MISC/SysMsg
    -I../../scintilla/include -I./include -c ../src/ScitillaComponent/AutoCompletio
    n.cpp -o ../src/ScitillaComponent/AutoCompletion.o
    ../src/ScitillaComponent/ScintillaEditView.h:563: warning: inline function `void
    ScintillaEditView::makeStyle(LangType, const char**)' used but never defined
    g++ -include./include/various.h -I../src -I../src/WinControls -I../src/WinContro
    ls/AboutDlg -I../src/WinControls/ContextMenu -I../src/WinControls/ColourPicker -
    I../src/WinControls/DockingWnd -I../src/WinControls/Grid -I../src/WinControls/Im
    ageListSet -I../src/WinControls/OpenSaveFileDialog -I../src/WinControls/Preferen
    ce -I../src/WinControls/shortcut -I../src/WinControls/SplitterContainer -I../src
    /WinControls/StaticDialog -I../src/WinControls/StaticDialog/RunDlg -I../src/WinC
    ontrols/StatusBar -I../src/WinControls/TabBar -I../src/WinControls/TaskList -I..
    /src/WinControls/ToolBar -I../src/WinControls/ToolTip -I../src/WinControls/TrayI
    con -I../src/WinControls/TreeView -I../src/WinControls/WindowsDlg -I../src/TinyX
    ml -I../src/ScitillaComponent -I../src/MISC -I../src/MISC/Exception -I../src/MIS
    C/PluginsManager -I../src/MISC/Process -I../src/MISC/RegExt -I../src/MISC/SysMsg
    -I../../scintilla/include -I./include -c ../src/ScitillaComponent/Buffer.cpp -o
    ../src/ScitillaComponent/Buffer.o
    In file included from ../src/Notepad_plus.h:44,
                     from ../src/ScitillaComponent/Buffer.cpp:10:
    ../src/WinControls/Preference/preferenceDlg.h:182:26: warning: no newline at end
    of file
    In file included from ../src/WinControls/WindowsDlg/SizeableDlg.h:4,
                     from ../src/WinControls/WindowsDlg/WindowsDlg.h:21,
                     from ../src/Notepad_plus.h:45,
                     from ../src/ScitillaComponent/Buffer.cpp:10:
    ../src/WinControls/WindowsDlg/WindowsDlgRc.h:2:1: warning: "_WIN32_IE" redefined

    In file included from <command line>:1:
    ././include/various.h:12:1: warning: this is the location of the previous defini
    tion
    In file included from ../src/WinControls/WindowsDlg/SizeableDlg.h:5,
                     from ../src/WinControls/WindowsDlg/WindowsDlg.h:21,
                     from ../src/Notepad_plus.h:45,
                     from ../src/ScitillaComponent/Buffer.cpp:10:
    ../src/WinControls/WindowsDlg/WinMgr.h:303:7: warning: no newline at end of file

    In file included from ../src/Notepad_plus.h:51,
                     from ../src/ScitillaComponent/Buffer.cpp:10:
    ../src/ScitillaComponent/SmartHighlighter.h:35:28: warning: no newline at end of
    file
    ../src/ScitillaComponent/Buffer.cpp: In member function `Buffer* FileManager::lo
    adFile(const char*, Document)':
    ../src/ScitillaComponent/Buffer.cpp:384: warning: NULL used in arithmetic
    ../src/ScitillaComponent/Buffer.cpp: In member function `bool FileManager::loadF
    ileData(Document, const char*, Utf8_16_Read*, LangType)':
    ../src/ScitillaComponent/Buffer.cpp:574: error: `__try' was not declared in this
    scope
    ../src/ScitillaComponent/Buffer.cpp:574: error: expected `;' before '{' token
    ../src/ScitillaComponent/Buffer.cpp:612: error: `GetExceptionCode' was not decla
    red in this scope
    ../src/ScitillaComponent/Buffer.cpp:612: error: `GetExceptionInformation' was no
    t declared in this scope
    ../src/ScitillaComponent/Buffer.cpp:612: error: `__except' was not declared in t
    his scope
    ../src/ScitillaComponent/Buffer.cpp:612: error: expected `;' before '{' token
    ../src/ScitillaComponent/Buffer.cpp:651:2: warning: no newline at end of file
    ../src/ScitillaComponent/ScintillaEditView.h: At global scope:
    ../src/ScitillaComponent/ScintillaEditView.h:563: warning: inline function `void
    ScintillaEditView::makeStyle(LangType, const char**)' used but never defined
    mingw32-make: *** [../src/ScitillaComponent/Buffer.o] Error 1
    /*ok,just commented these "try-except"*/
    src/ScitillaComponent/Buffer.cpp changes:
    d574 1
    a574 1
            //__try {
    d612 1
    a612 1
            /*}__except(filter(GetExceptionCode(), GetExceptionInformation())) {
    d615 1
    a615 1
       }*/
    d651 1
    a651 1
    }
    --
    mingw32-make
    bin/NotepadPP.exe built OK

    Expected behaviour:
    Notepad++ 5.03 built under MinGW GCC 3.4.5 without errors.
    Please fix it.

    Best regards,

     
    • Vorenus

      Vorenus - 2008-08-08

      Solution: MS Visual C++ Express 2008.

      http://download.microsoft.com/download/d/c/3/dc3439e7-5533-4f4c-9ba0-8577685b6e7e/vcsetup.exe

      It's free and it doesn't produce bloated executables like mingw.

       
      • NoAngel

        NoAngel - 2008-08-25

        MS Visual C++ Express 2008 is not very good solution for me. It's free, but it's not open source compiler.
        If You compile using MS Visual C++ Express 2008, executable will not be compatible with Win 9x/ME/NT4.
        Also to avoid some problems with VC runtimes, it's better to compile with /MT (static build), which will increase size of output binaries.
        MinGW uses msvcrt.dll, which is available since Windows 95 (and don't need to be installed from "VC runtime package").
        Also I had some problems before, when trying to build with VC++ 2008 Express and even VC++ 2008 Pro(errors in VS header files).
        When using VC++ 2005 SP1, there are no problems. VC++ 2008 SP1 is to be checked later.

         
        • Harry

          Harry - 2008-08-25

          In order to prevent notepad++ from crashing when loading a file that is simply too large, Don added __try __except if I recall correctly. I added a header file for compiling with MingW that gets included everywhere, you can try adding a
          "#define __try"
          "#define __except(x)"
          or something similar to prevent those form being added. The runtime behaviour wil lbe different, but the whole exception handling model of Notepad++ isnt suited for MingW anyway (MingW doesnt support eh.h header which Notepad++ uses).

          As for Scintilla, I never tried compiling that. It seems to build ok though the search result lexer fails due to what looks like a typo, ill take a look at it.

          Harry

           
          • NoAngel

            NoAngel - 2008-08-25

            >In order to prevent notepad++ from crashing when loading a file that is simply too large, Don added __try __except if I recall correctly.

            But there is more simple and ompatible way: just open file(fopen(...)), then use fseek to set pointer to end of file, then get pointer position with ftell and check if file too big with "if" operator. Why using try...except?

             
            • Sune Marcher

              Sune Marcher - 2008-08-25

              > But there is more simple and ompatible way: just open file(fopen(...)),
              > then use fseek to set pointer to end of file, then get pointer position
              >  with ftell and check if file too big with "if" operator. Why using
              > try...except?

              Simple - because there's no clear reason *what* "too big" means. Now, the smartest thing would be tracing the code properly to find out what exactly causes crash, and then add some safeguards or whatever, but that might not be a simple job.

               
    • NoAngel

      NoAngel - 2008-08-25

      P.S. ompatible=compatible