A lot of flailing around with different code bases and build environments. What I recommend is that you set up a virtual machine for building O. I use Linux
because the build environment
is so much simpler than Windows.
Windows VS2012 is also ok as a development environment
. Get rid of all the old V4.0 code base and get fresh from GIT the latest sources. Before you start trying to build plugins get V4.1.178 (or whatever the latest is) building and installing. It builds 2 plugins as part of the default build. Then learn how to put plugin source trees within the O tree. For most of the mainline plugins the standard O build process will build the plugins and add them to the install package.
Next, get your windows build environment configured so you can debug plugins. For that you have to put certain files in certain places within the OpenCPN\build tree. The web site instructions explain this. The instructions are precise but brief. Read them carefully and follow exactly. You will know you have it right when you can set a breakpoint in a plugin and see the breakpoint become "active" when the DLL loads.
Once you can debug O and known good plugins in Windows then you are ready to launch into your own plugin development. Learn how to create your own plugin cmake configuration so that the standard O build process will build and add your plugin to the installation
. This is not a one day learning
process. For a good developer it can take a few days studying the whole setup and learning
how it is supposed to work. Don't try to force the O development process to fit what you think it should be. You will be frustrated for a long time. So learn how it works and follow it along.