Question

I am creating simple XPCOM plugin for firefox by using the code from. blog.peschla.net code is straight forward but Im getting following error: Error 1 error MSB3073: The command "xpidl-build.bat IHelloWorld.idl :VCEnd" exited with code 1. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 103 6 HelloWorld I am using firefox 22 hence gecko-sdk version 22 and vs2010 I used following files.

I have given link above which contains all the code but I am giving code below as well

1)HelloWorld.h

#include "HelloWorld.h"

NS_IMPL_ISUPPORTS1(HelloWorld, IHelloWorld)

HelloWorld::HelloWorld()
{
mName.Assign(L"Nameless");
}

HelloWorld::~HelloWorld(){}

/* attribute AString name; */
NS_IMETHODIMP HelloWorld::GetName(nsAString & aName)
{
    aName.Assign(mName);
    return NS_OK;
}

NS_IMETHODIMP HelloWorld::SetName(const nsAString & aName)
{
    mName.Assign(aName);
    return NS_OK;
}

/* long add (in long a, in long b); */
NS_IMETHODIMP HelloWorld::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM)
{
    *_retval = a + b;
    return NS_OK;
}

2)HelloWorld.cpp

#include "HelloWorld.h"

NS_IMPL_ISUPPORTS1(HelloWorld, IHelloWorld)

HelloWorld::HelloWorld()
{
    mName.Assign(L"Nameless");
}

HelloWorld::~HelloWorld(){}

/* attribute AString name; */
NS_IMETHODIMP HelloWorld::GetName(nsAString & aName)
{
    aName.Assign(mName);
    return NS_OK;
}

NS_IMETHODIMP HelloWorld::SetName(const nsAString & aName)

{
    mName.Assign(aName);
    return NS_OK;


}

/* long add (in long a, in long b); */
NS_IMETHODIMP HelloWorld::Add(PRInt32 a, PRInt32 b, PRInt32 *_retval NS_OUTPARAM)
{
    *_retval = a + b;
    return NS_OK;
}

3)IHelloWorld.idl

#include "nsISupports.idl"

[scriptable, uuid(2f52e0f0-0eac-11e1-be50-0800200c9a66)]
interface IHelloWorld : nsISupports
{
    attribute AString name;
    long add(in long a, in long b);
}

4)HelloWorldModule.cpp

#include "mozilla/ModuleUtils.h"
#include "nsIClassInfoImpl.h"
#include "HelloWorld.h"

NS_GENERIC_FACTORY_CONSTRUCTOR(HelloWorld)

// The following line defines a kHELLOWORLD_CID CID variable.
NS_DEFINE_NAMED_CID(HELLOWORLD_CID);

static const mozilla::Module::CIDEntry kSampleCIDs[] = {
     { &kHELLOWORLD_CID, false, NULL, HelloWorldConstructor },
        { NULL }
};

static const mozilla::Module::ContractIDEntry kSampleContracts[] = {
     { HELLOWORLD_CONTRACTID, &kHELLOWORLD_CID },
     { NULL }
};

static const mozilla::Module kSampleModule = {
     mozilla::Module::kVersion,
     kSampleCIDs,
     kSampleContracts,
     NULL /* or a category definition if you need it */
};

NSMODULE_DEFN(nsSampleModule) = &kSampleModule;

5)xpidl-build.bat (using as Command Line call to the Pre-Build Event)

..\..\xulrunner-sdk\sdk\bin\xpidl.exe -m header -I..\..\xulrunner-sdk\idl %1
..\..\xulrunner-sdk\sdk\bin\xpidl.exe -m typelib -I..\..\xulrunner-sdk\idl %1
Was it helpful?

Solution

I found my mistake.Reason for error: "I was putting gecko-sdk in wrong directory".Now my project is able to build. Thanks to all who had replied for this thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top