Author Topic: HelloWorld plugin problems installing  (Read 17762 times)

CrazyZ

  • Guest
HelloWorld plugin problems installing
« on: November 19, 2007, 01:59:05 am »
Hi guys,

I have just started getting into Code::Blocks and I really want to help contribute to this by creating plugins.  So I've started with the HelloWorld plugin, which I had some trouble with because it's a bit outdated.  So as soon as I can get his first plugin working, I'm going to update it.

Anyways, I've had quite a bit of problems actually getting this thing working.  I finally got it to compile correctly, but when I go to "Manage Plugins..." and "Install New", and select my .cbplugin.  But it just says "One or more plugins were not installed successfully..."

Anyways, the little pop-up at the bottom says I should check the application log... but it doesn't tell me where this log is located at all and I can't find it anywhere.

Can you guys help me out by telling me where to find out the application log?

thanks

Offline Howard

  • Single posting newcomer
  • *
  • Posts: 8
Re: HelloWorld plugin problems installing
« Reply #1 on: November 19, 2007, 03:16:04 pm »
...
Anyways, the little pop-up at the bottom says I should check the application log... but it doesn't tell me where this log is located at all and I can't find it anywhere.

Can you guys help me out by telling me where to find out the application log?

thanks

If you have recently updated from svn, you may have to click menu/view/layouts/delete current.

That worked for me.
« Last Edit: November 19, 2007, 03:17:37 pm by Howard »

Online stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: HelloWorld plugin problems installing
« Reply #2 on: November 19, 2007, 04:48:17 pm »
The lower window with build log and build messages; right click on its title bar and see if you can turn it on.

The last few builds, I think it might have been called "Code::Blocks" under toggle option.

Tim S
« Last Edit: November 19, 2007, 04:50:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

CrazyZ

  • Guest
Re: HelloWorld plugin problems installing
« Reply #3 on: November 20, 2007, 07:11:51 am »
Thanks you guys so much for the quick reply.

I got this as the error message for the build:

C:\Program Files\Code Blocks/share/codeblocks/plugins/HelloWorld.dll: not loaded (missing symbols?)

Unfortunately, I don't understand what's going on because it compiled alright, so I would have though that all the symbols would have been taken care of?  I will post my code below:

Code
#include <sdk.h> // Code::Blocks SDK
#include <configurationpanel.h>
#include "HelloWorld.h"

#include <manager.h>
#include <logmanager.h>

// Register the plugin with Code::Blocks.
// We are using an anonymous namespace so we don't litter the global one.
namespace
{
    PluginRegistrant<HelloWorld> reg(_T("HelloWorld"));
}

// constructor
HelloWorld::HelloWorld()
{
    // Make sure our resources are available.
    // In the generated boilerplate code we have no resources but when
    // we add some, it will be nice that this code is in place already ;)
    if(!Manager::LoadResource(_T("HelloWorld.zip")))
    {
        NotifyMissingFile(_T("HelloWorld.zip"));
    }
}

// destructor
HelloWorld::~HelloWorld()
{
}

void HelloWorld::OnAttach()
{
    // do whatever initialization you need for your plugin
    // NOTE: after this function, the inherited member variable
    // m_IsAttached will be TRUE...
    // You should check for it in other functions, because if it
    // is FALSE, it means that the application did *not* "load"
    // (see: does not need) this plugin...
}

void HelloWorld::OnRelease(bool appShutDown)
{
    // do de-initialization for your plugin
    // if appShutDown is true, the plugin is unloaded because Code::Blocks is being shut down,
    // which means you must not use any of the SDK Managers
    // NOTE: after this function, the inherited member variable
    // m_IsAttached will be FALSE...
}

int HelloWorld::Execute()
{
    // do your magic ;
    if( !IsAttached() )
        return -1;
    Manager::Get()->GetLogManager()->Log( _("Hello World!") );
    return 0;
}

Thanks guys again for helping out! :)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: HelloWorld plugin problems installing
« Reply #4 on: November 20, 2007, 08:29:07 am »
Unfortunately, I don't understand what's going on because it compiled alright, so I would have though that all the symbols would have been taken care of?  I will post my code below:
I think you are missing to provide a (zipped) manifest.xml file for the plugin (and putting it into the right place). Look at other plugins how they do that... for example the envvars plugin. Notice the post build steps and that the zip archive has to have the same name as your plugin (case sensitive on linux). Anyways... it's really simple! :-)
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: HelloWorld plugin problems installing
« Reply #5 on: November 20, 2007, 05:29:01 pm »
If you are using the latest nightly build (4639) the problem may be caused by a bug. A recently applied patch (this one) broke post build commands, and they are required to correctly build a plugin.
The bug has been fixed though, so as soon as a new nightly build is out just update it and everything should work again.

Regards, XayC
« Last Edit: November 20, 2007, 05:31:17 pm by XayC »

CrazyZ

  • Guest
Re: HelloWorld plugin problems installing
« Reply #6 on: November 21, 2007, 08:47:55 am »
alrighty then, i suppose i'll just wait for the next nightly build.

thanks guys!

CrazyZ

  • Guest
Re: HelloWorld plugin problems installing
« Reply #7 on: December 02, 2007, 10:40:21 pm »
So I got the newest nightly build, and tried to compile (successful, no error messages), and install the plugin, but I still get the following error, which is the same as the last time:

C:\Program Files\Code Blocks/share/codeblocks/plugins/HelloWorld.dll: not loaded (missing symbols?)

I'm looking at the HelloWorld.zip file that was generated in my source code directory, and it only contains the manifest.xml file; nothing else.  Do you guys know what is going on???

Thanks!

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: HelloWorld plugin problems installing
« Reply #8 on: December 03, 2007, 01:39:40 am »
It looks like you are trying to install to a downloaded cb nightly build? if so, then you need to make sure you link against the codeblocks.dll and wxmswXXXXX.dll in the nightly build and not against those in your compiled cb and wxwidgets sources.

more normal practice for building and testing your own plugins is to:
1. build wxwidgets and cb from sources yourself (build a release version of WX and a debug version of CB).
2. compile and link your plugin against those sources and their corresponding binaries (it is common C::B practice to define cb and wx global variables and use them in your project and build setttings so you don't have to hardcode paths)
3. add a post build script that copies you plugin dll and manifest to $(#cb)/devel/share/Codeblocks/[plugins/]
4. make sure that you set Project->Set program arguments to $(#cb)/devel/Codeblocks.exe with optional program arguments --personality=debug (so that you can set up environment settings that differ from your default set)
5. make sure you do NOT strip debugging symbols in your plugin build options
6. now you can run or debug your plugin from within CB.
7. to build a release version of cb (with stripped binaries) with included plugins run the update.bat script found in the CB source -- note that these binaries won't be compatible with the nightly builds.

anyway, if this is your problem then you aren't alone. plenty of new plugin developers stumble at this first step.
« Last Edit: December 03, 2007, 01:49:11 pm by dmoore »

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: HelloWorld plugin problems installing
« Reply #9 on: December 03, 2007, 05:16:53 pm »
And if you want to build a plugin which can work also with the nightly builds, you have to link it to wxmsw28u_gcc_cb.dll instead of wxmsw28u_gcc_custom.dll.
The generated name for the wxWidgets dll can be selected when compiling wxWidgets, you have to add VENDOR=cb to the makefile options.

Regards, XayC.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: HelloWorld plugin problems installing
« Reply #10 on: December 03, 2007, 06:06:18 pm »
you have to add VENDOR=cb to the makefile options.
You should *not* do that. This is deprecated and was the root of many issues. Just leave the vendor as it is (don't provide this for the compilation of wx).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline XayC

  • Multiple posting newcomer
  • *
  • Posts: 94
Re: HelloWorld plugin problems installing
« Reply #11 on: December 04, 2007, 05:20:07 pm »
You should *not* do that. This is deprecated and was the root of many issues. Just leave the vendor as it is (don't provide this for the compilation of wx).

Ah, ok :oops: good to know.
So how can I build a plugin that will correctly load with a nightly build? And how is wxWidgets built to get the wxmsw28u_gcc_cb.dll file provided with the nightly builds?

Thanks, XayC.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: HelloWorld plugin problems installing
« Reply #12 on: December 04, 2007, 07:26:59 pm »
So how can I build a plugin that will correctly load with a nightly build?

you need to make sure you link against the codeblocks.dll and wxmswXXXXX.dll in the nightly build and not against those in your compiled cb and wxwidgets sources.

you don't have to link against the .a files, you can link directly to the .dll files

Quote
And how is wxWidgets built to get the wxmsw28u_gcc_cb.dll file provided with the nightly builds?

Correct me if I'm wrong, but I imagine they do use VENDOR=cb. The point is the C::B devs are the official vendor of that wx build. When you create your own build of wx it is not necessarily compatible with the cb build so you should not give them the same name. It is far easier to diagnose the error of someone trying to run a plugin compiled against one build of a library but run against another incompatible build of that library if they don't share the same name.
« Last Edit: December 04, 2007, 07:28:57 pm by dmoore »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: HelloWorld plugin problems installing
« Reply #13 on: December 04, 2007, 08:16:31 pm »
Quote
And how is wxWidgets built to get the wxmsw28u_gcc_cb.dll file provided with the nightly builds?
Correct me if I'm wrong, but I imagine they do use VENDOR=cb.
Partially. Killerbot does but he knows exactly what he is doing. I don't and I believe Yiannis and Thomas don't, too. If you compile wx for C::B only you *can* do this but you better shouldn't. Search the forum for more information on vendor=cb.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: HelloWorld plugin problems installing
« Reply #14 on: December 04, 2007, 08:20:43 pm »
So how can I build a plugin that will correctly load with a nightly build?

Link your plugin to the nightly's wxmsw28u_gcc_cb.dll...
Be patient!
This bug will be fixed soon...