Trouble compiling test plugin (ANSI error)
-
I’m attempting to compile and run a test plugin using Visual Studio. I opened the plugin template in VS by File -> New -> Project From Existing Code. I modified the project’s Configuration Type in Properties to .dll. The platform is set to Win32 and I’ve confirmed I’m using the x86 version of npp. When I compile the .dll and place in C:\Program Files (x86)\Notepad++\plugins\test, launching npp gives the following error:
“This ANSI plugin is not compatible with your Unicode Notepad++.”
Have I caused issues by opening the plugin template in VS in the way I described? I was having trouble figuring out how to import the template into VS to have it shown on the new project creation screen.
Forgive my naivety as I’m new to using Visual Studio and am hoping to build a plugin for my personal use.
-
@CAKEbuilder said in Trouble compiling test plugin (ANSI error):
I opened the plugin template in VS by File -> New -> Project From Existing Code.
are you working on c# ?
i have VS 2012 is installed and you? -
I’m using Visual Studio 2019, should I be using an older version for plugin development?
-
yes both NppPlugin.NET.v0.6.zip and NppPlugin.NET.v0.5.zip not works with VS 2012
i have a source project you can modify it easy https://github.com/gurikbal/Remove_dup_lines
and you can build it online also https://ci.appveyor.com/project/gurikbal/remove-dup-lines
-
@CAKEbuilder said in Trouble compiling test plugin (ANSI error):
I’m using Visual Studio 2019, should I be using an older version for plugin development?
That version is fine; don’t be misled by bad advice.
-
I’ve never made a plugin, but doesn’t that error refer to forgetting to define that dummy function to indicate “I am a Unicode plugin, not an ANSI plugin”?
I would think all the plugin templates would come with that function defined nowadays, since it’s been years since the last ANSI-only Notepad++ where that function was relevant, but maybe the OP started from an ancient template.
Check a recent template for the actual name of the function.
-
Yeah, it’s a Boolean that returns true, named
isUnicode()
Without that function, Notepad++ will assume the plugin was written for an ANSI-only Notepad++, which is not compatible with current Notepad++ builds.
-
as @PeterJones already posted you need to implement isUnicode function and return True.
In addition, these functions need to be implemented as wellisUnicode -> return True always getName -> return your plugin name setInfo -> informs your plugin about notepad++ and scintilla handles beNotified -> called in case of npp or scintilla events messageProc -> called in case of windows messages forwarded by npp getFuncsArray -> return the functions which should be available within your plugin menu