Building Notepad++ with Visual Studio 2015/2017
-
I would like to join the project so I downloaded the sources and tried following the instructions to build NPP, but failed to so so far.
I have VS 2015 (update 3) and VS 2017 installed on my computer, and I do not have VS 2013 installed. Therefore, the only toolset I have is 14.1. However, the build script (\scintilla\boostregex\BuildBoost.bat) seem to look for toolsets 12.0 and earlier.
I tried modifying the BuildBoost.bat to support msvc-14.1 toolset. Tried building (with boost 1.64). Then I got second problem: Boost builds the module so that its name looks like this: libboost_regex-vc141-mt-1_64.lib, but when I try to compile scintilla using the make file or in visual studio, it says it cannot find libboost_regex-vc140-mt-s-1_64.lib.
I tried renaming the library but it does not do the trick.
Before I spend more time on this: Did anyone try building with VS 2015, where VS 2013 is not around to support toolset 12.0?
-
I just managed to get it working with boost 1_63_0 / VS 2015 / msvc-14.0 .
C++ and all this linking malarky isn’t my usual poison so I can’t offer expert advice, but I took notes as I went and I’ve uploaded the modified BuildBoost.bat here… https://pastebin.com/VwhkZNQHVS2015 boost build for notepad++
-
Using Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3 (most options installed)
-
Using current boost version 1_63_0 which natively supports VS2015 - https://sourceforge.net/projects/boost/files/boost/1.63.0/
(Older boost versions may need to have visualc.hpp edited as described here - https://stackoverflow.com/questions/30760889/unknown-compiler-version-while-compiling-boost-with-msvc-14-0-vs-2015/)
(NB: b2.exe is exact same as bjam.exe! See - http://www.boost.org/build/doc/html/bbv2/faq/names.html) -
Source files downloaded to:
C:\Source\notepad-plus-plus-master
C:\Source\boost_1_63_0 -
Boost 1_63_0 has bootstrap.bat & b2.exe in ‘…tools\build’ instead of ‘…tools\build\v2’ so minor edit of npp’s BuildBoost.bat required, so created ‘BuildBoost-VS2015edit.bat’ in same folder.
-
‘BuildBoost-VS2015edit.bat’ also adds case for msvc-14.0 target path since it’s required to auto-generate the scintilla make file.
NB: BuildBoost.bat does not support --toolset since PARAMLOOP code is commented out, so hacked version requires this parameter order:
Usage:
BuildBoost-VS2015edit.bat PathToBoost [–toolset ToolsetVersion] [-x64]
EG:
BuildBoost-VS2015edit.bat C:\Source\boost_1_63_0 --toolset msvc-14.0-
Launch ‘Developer Command Prompt for VS2015’ from Start Menu
cd C:\Source\notepad-plus-plus-master\scintilla\boostregex -
Launch BuildBoost: (NB: BuildBoost-VS2015edit.bat requires --toolset parameter after path to boost!)
BuildBoost-VS2015edit.bat C:\Source\boost_1_63_0 --toolset msvc-14.0 -
(boothpath.mak should now have been created containing path to Boost source and also to newly generated Boost regex libs)
-
Make scintilla
cd C:\Source\notepad-plus-plus-master\scintilla\win32
nmake -f scintilla.mak
Now should be able to open ‘C:\Source\notepad-plus-plus-master\PowerEditor\visual.net\notepadPlus.vs2015.vcxproj’ and proceed.
NB: There is a certificate check for SciLexer.dll that will fail with newly built version… so I commented out call to VerifySignedLibrary in loadSciLexerDll() function as kindly suggested by dail here… https://notepad-plus-plus.org/community/topic/14054/certificate-required-for-building-notepad
-
-
Got it working in VS2017 as well using above instructions with these small changes:
- boost_1_64_0 - has support for VS2017/msvc-14.1 built in
- Small tweak to above mentioned BuildBoost-VS2015edit.bat uploaded as Gist: buildboost-vs2017edit.bat
- I had a clean install of VS2017 Community Edition - but by default some of the SDKs were not installed leading to “cannot find windows.h” type errors. So in the VS2017 installer I had to go to “Individual componets” tab and install some SDKs… I think the only one required extra was “Windows XP support for C++” but possibly also “Windows 8.1 SDK”
-
Got it working in VS 2017 + boost_1_65_1 + msvc-14.1 using moon6969’s buildboost-vs2017edit.bat
On VS 2017 Community Edition I had to install Windows XP Support for C++ and Windows Universal CRT SDK in order to correct the “cannot find…” errors.
I had some Compiler Errors C2220 as well, then had to bypass the /MX option (which tells the compiler to treat all warnings as error).
-
I made some mods to my version of buildboost2017.bat, which is based on moon6969’s buildboost-vs2017.bat. Mine now auto-detects the VS tool version for VS2015/VS2017 and handles command-line args in any order.
I just used it to build boost_1_65_1 with VS2017 by entering:
buildboost2017.bat c:\source\boost\boost_1_65_1
Loaded the VS2017 project, changed the build from x64 to x86, and built it.
After successful build, copied .\scintilla\bin\SciLexer.dll to .\PowerEditor\visual.net\Unicode Debug.
Then ran .\PowerEditor\visual.net\Unicode Debug\notepad++ successfully!Note that boost_1_66_0 does not seem to build correctly, but 1_65_1 builds just fine.
-
There were already some PRs on this, not integrated by donho:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/2336
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/2062There is also a visual studio project using nuget for boost, which could be used, see https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/win32/SciLexer.vcxproj. But that is still at VS2013.
-
@donho what kind of PR would you accept on this? At least a update for vs2015 seems meaningfull to me.
-
I have been trying endlessly for 1 day now and felt i needed to ask for help.
I tried to follow first the 2015 version and then the 2017. After getting many different times install errors, and trying to update visual studio to different packages like a mad dog, i ended up with this.LINK : fatal error LNK1104: cannot open file ‘…\bin\Scintilla.dll’
NMAKE : fatal error U1077: ‘“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x86\link.EXE”’ : return code ‘0x450’
Stop.This was the 2017 version with the bat script supplied above.
I have no idea how to proceed, any tips. What have i overlooked -
I solved it, now i am trying to solve the build order and how to include it in the right place.
The solution was obvious i accidentally removed the bin directory, the one in the root directory. -
The final thing was changing the project to 86 instead of 64. So basically Gary Blooms version works fine for me
And you may ask why did i do 3 posts and not edit 1? Well for some reason this site don’t allow you to edit your post after 180 seconds, which is weird but hey when in rome.
-
Greetings! I am trying to build Notepad++ with Visual Studio 2017, but I’m having some difficulties. I’m following Gary Bloom’s plan and I’ve gotten as far as changing the build from x64 to x86 without any problems. However, when I try to build it, I get the following error message:
fatal error C1083: Cannot open include file: ‘atlbase.h’: No such file or directory
I have confirmed that both “Visual C++ ATL Support” and “MFC and ATL Support (x86 and x64)” are installed, but the issue persists. Any advice?
-
Ah, I’ve gotten it to build. I needed to switch the project from the 2015 toolset to the 2017 toolset.
-
Build notes from NPP v7.6.3
Use Boost 1_65_1 to build scintilla.dll
First looked at using latest Boost 1_69_0, but failed.
Since Boost 1_66_0, the Boost lib file name structure now has extra “x32” detail:
libboost_regex-vc141-mt-s-1_65_1.lib
vs
libboost_regex-vc141-mt-s-x32-1_66.lib
This causes issue in BuildBoost.bat since it can’t autodetect the library file.
This can be worked around using--toolset msvc-14.1
, but then scintilla.mak fails with some architecture related error from Boost source…
boost_1_69_0\boost/type_traits/detail/is_function_cxx_11.hpp(111): error C2218: '__vectorcall' cannot be used with '/arch:IA32'
So I just continued using Boost 1_65_1 (and Gary Bloom’s above buildboost2017.bat).
Build notepadPlus.vcxproj in VS2017
- Copied
scintilla\bin\SciLexer.dll
toPowerEditor\visual.net\Unicode Debug\
- When opening
notepad-plus-plus-7.6.3\PowerEditor\visual.net\notepadPlus.vcxproj
the first time, I was prompted by VS to “Retarget Projects” to v141_xp. - Changed the VS “Solution Platform” from x64 to x86
- Copied
-
Build notes for NPP v7.8.2 32bit with Visual Studio 2017 on Win10
Build process on NPP’s github has been updated to no longer include requirement for BuildBoost*.bat. It worked pretty smoothly, except for minor difference with boost_1_72_0 compared to boost_1_70_0.
Use Boost 1_72_0 to build SciLexer.dll
- Download boost_1_72_0 from https://www.boost.org/
- Open “Visual Studio 2017 Developer Command Prompt”
cd <base>\boost_1_72_0\
bootstrap.bat
cd <base>\boost_1_72_0\libs\regex\build
<base>\boost_1_70_2\b2.exe toolset=msvc link=static threading=multi runtime-link=static release stage
- Copy
libboost_regex-vc141-mt-s-x32-1_72.lib
to<base>\boost.tmp\
NB: Contrary to github guide (step 4), I found libboost_regex-vc141-mt-s-x32-1_72.lib in:
<base>\boost_1_72_0\stage\lib\ . cd <base>\notepad-plus-plus-7.8.2\scintilla\win32\
nmake BOOSTPATH=<base>\boost_1_72_0\ BOOSTREGEXLIBPATH=<base>\boost.tmp\ -f scintilla.mak
- Copy
<base>\notepad-plus-plus-7.8.2\scintilla\bin\SciLexer.dll
to<base>\notepad-plus-plus-7.8.2\PowerEditor\visual.net\Unicode Debug\
- Open
<base>\notepad-plus-plus-7.8.2\PowerEditor\visual.net\notepadPlus.vcxproj
in VS2017 - Change configuration to x86
- Build & enjoy
NB: If debugging NPP from within VS, enable Multi-instance in NPP settings or close other instances of notepad++.exe
-
@moon6969 said in Building Notepad++ with Visual Studio 2015/2017:
NB: If debugging NPP from within VS, enable Multi-instance in NPP settings
Or…what I do is add it to the VS properties like so (shown for VS2019):
-
Build successfull on newly installed Visual Studio 2019 Community Edition. I followed the above v7.8.2 notes.
On opening
notepadPlus.vcxproj
, I accepted prompt in VS2019 to upgrade SDK to v10 and Platform Toolset to v142.On first build, there is a new C++ warning…
C4834:discarding return value of function with 'nodiscard' attribute
VS2019 was treating it as an error, so I added
/Wv:19.10
compiler option (to use an earlier C++ versions warnings)…
-
@moon6969 said in Building Notepad++ with Visual Studio 2015/2017:
On first build, there is a new C++ warning…
C4834:discarding return value of function with 'nodiscard' attribute
Disclaimer: I’ve no idea what this warning means or the impact of ignoring it… but it seems to work :)
-
-
so I added /Wv:19.10 compiler option
Where did you get the idea to use that exact number?
(I just turn off “treat warnings as errors” instead when I have built the source code)
-
the C4834 link directs to this warning setting.