如何编译Notepad++

本文详细介绍了使用Visual C++ 2008 Express Edition和Visual C++ 2010 Express Edition从源代码编译Notepad++的方法。包括设置开发环境、编译步骤及注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转发

Compiling Notepad++

How To Compile Notepad++ From Source


There should be several ways to generate Notepad++ binaries.

The official releases of Notepad++ are generated using Visual Studio 2005.


Contents

Using Visual C++ 2008 Express Edition

Setup

  1. Download and install Visual C++ 2008 Express Edition. There are 3 components; it is only necessary to install the first (IDE) and not the other two (MSDN and Database).
  2. Run Visual C++ 2008 Express Edition once to set up environment (it is mentioned somewhere in the SDK documentation to do this).
  3. Download and install the Platform SDK whose exact name is "Windows Server 2008".
  4. Start Visual C++ 2008 Express Edition again, go to Tools -> Options -> Projects and Solutions -> VC++ Directories, and do these three steps (using the 'arrow up' button):
    1. In Show directories for -> Executable Files, move $(WindowsSdkDir)\bin up so its above $(VCInstallDir)\bin.
    2. In Show directories for -> Include Files, move $(WindowsSdkDir)\include up so its above $(VCInstallDir)\include.
    3. In Show directories for -> Library Files, move $(WindowsSdkDir)\lib up so its above $(VCInstallDir)\lib.
  5. Download the Notepad++ source code. There are several ways to do this. Select one of the following methods:
    • Either check out the source code directly from Subversion; the repository URL is svn://svn.tuxfamily.org/svnroot/notepadplus/repository. You can use TortoiseSVN or any other SVN client to check it out. Check it out into your My Documents\Visual Studio 2008\Projects\ folder.
    • Or download a GNU tarball of the latest source code from the Subversion web interface. Unpack the tarball to a new folder in your My Documents\Visual Studio 2008\Projects\ folder.
    • Or download the zip file "npp.6.6.6.src.7z" in the folder "npp 6.6.6 src" that should exist in the "notepad++ releases source" folder at Sourceforge. At the time of writing this, though, the zip file of the latest version was not available. But if it is, download it and unzip it as a new folder in your My Documents\Visual Studio 2008\Projects\ folder.
  6. Download the latest Boost library from http://www.boost.org/users/download/ and unzip in a hard disk of your choice. The archive only contains one folder with a lush sbtree under it.

Build Notepad++ v6.6.6 (win32, Debug)

  1. Within VC++ IDE select Tools -> Visual Studio 2008 command prompt
  2. Change current directory to your\sorce_code\directory\scintilla\boostregex. Don't forget to surround this path with double quotes if it contains spaces.
  3. Now run
BuildBoost.bat --toolset msvc-9.0 your\boost\install\folder

The folder should have the "bin v2" subfolder right below it.

  1. If all goes well, the console informs you of the next two steps:
  2. Change directory to ..\win32
  3. From there, run
nmake -f scintilla.mak"
  1. At this point you have a SciLexer.dll ready in ..\bin, with full regula expression support. You can safely ignore the harmless warnings about unused local functions. Copy it where your executable should be created - it needs it.
  2. Open My Documents\Visual Studio 2008\Projects\npp.6.6.6.src\PowerEditor\visual.net\notepadPlus.vcproj.
    • IMPORTANT: do NOT open notepadPlus.7.0.vcproj, it doesn't build (linker error).
  3. Allow the project upgrade wizard to run with defaults
  4. Select Project -> Build Order and confirm that SciLexer is before notepadPlus in the build order
  5. Build the solution. When prompted save your vc2008 project somewhere (eg My Documents\Visual Studio 2008\Projects\npp.6.6.6.src\PowerEditor\visual.net\SciLexer vc2008). The IDE should build Scintilla first, followed by Notepad++. There should be no errors besides the following:
  6. The result of the Notepad++ build is My Documents\Visual Studio 2008\Projects\npp.6.6.6.src\PowerEditor\visual.net\Debug\Notepad++.exe. You must have copied SciLexer.dll there. Otherwise, Notepad++ might try an older dll with unpredictable results.

How to build a sample plugin (NppPluginDemo)

This is how to build a sample plugin. Note that building a plugin is not necessary if you just want to compile Notepad++ itself.

  1. Download and unzip the Notepad++ Plugin Demo source code into the folder My Documents\Visual Studio 2008\Projects\NppPluginDemo.
  2. Within Visual Studio 2008 select File -> Open -> Project/Solution and open the project My Documents\Visual Studio 2008\Projects\NppPluginDemo\NppPluginDemo.vcproj; allow the project upgrade wizard to run with defaults.
  3. Save your Visual Studio 2008 project under a new name.
  4. Build the solution.
  5. The result of the plugin build is found in My Documents\Visual Studio 2008\Projects\notepad++\PowerEditor\bin\plugins.
  6. IMPORTANT: Try the Release builds to see if they also work.

A recommended development environment

The following has been posted on Open Discussion Forum and results from interactive setup through the official Notepad++ IRC channel.

  1. Use Visual C++ 2008 EE
  2. Checkout the latest trunk
  3. Open the PowerEditor visual.net notepadPlus.vcproj file
  4. Add dependency to PowerEditor (it should depend on SciLexer).


Using Visual C++ 2010 Express Edition

See the article How to build Notepad++ with Visual C++ 2010 Express?.


Fixing or enhancing Notepad++

So you modified the code, and that has fixed a bug, enhanced or added some functionality?

Then the usual rules about open source code apply:

  • thoroughly test that you don't cause regressions, ie break something that previously worked. If at all possible, ask non programmers to test. They are pretty good at hitting gaping faults we don't see.
  • Incorrectly commented code is bad code. You have no idea of whoever will maintain your code, neither when nor why. No one else does anyway.

Brilliant and perfect? Then you can contact the main developer about it. Make a patch to apply your mods to the latest revision on SVN, and submit it at https://sourceforge.net/tracker/?group_id=95717&atid=612384

You may want to read this thread: How do I join the development team?.

And the story ends here, they lived happy and had lots of lines of code.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值