Building Notepad++ with Visual Studio 2015/2017
-
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.
-
Ah, never knew that. Presume one could also use 19.10.25017.0 in this case.