0

Possible Duplicate:
What is an undefined reference/unresolved external symbol error and how do I fix it?

#include <FakeMas.h>
#include <zinc-testsupport-client-api/ClientFactory.h>
#include <zinc-testsupport-client-api/Process.h>
#include <zinc-testsupport-client-api/ProcessCreator.h>

    FakeMas::FakeMas() {    
        ClientFactory &clientFactory(PluginFactory::getInstance<ClientFactory>(pluginConfig));
        boost::shared_ptr<ProcessCreator> webServerProcessCreator = clientFactory.createProcessCreator();
    }

when I build it, I get an error says :

...../src/.libs/libZincTestWebServer.so: undefined reference to `zinc::testsupport::client::ClientFactory::createProcessCreator()'

the interesting thing is that if I comment off the second line of class

boost::shared_ptr<ProcessCreator> webServerProcessCreator = clientFactory.createProcessCreator()

then it will build success

so I feel confused, it seems there is no linkage problem since it can be built with

ClientFactory &clientFactory(PluginFactory::getInstance<ClientFactory>(pluginConfig))

so How it can find the class but cannot find the function??

BTW, I think the function is declared and defined in a right way:

boost::shared_ptr<ProcessCreator> ClientFactory::createProcessCreator() {
    .........
}

any one got any idea about it? Thanks

Community
  • 1
  • 1
user1853170
  • 65
  • 1
  • 2
  • 8

1 Answers1

0

I recommend checking the source file(s) where you have the class ClientFactory defined (not declared) and make sure you have an implementation of the method createProcessCreator(). It's certainly possible to have a valid class and create an instance of it even if one of its methods is declared but not implemented.

Also check your link command to make sure you're linking with the object file that you think contains this method.

P.S. Also check spelling and capitalization of that method to make sure it matches everywhere (although I think if that were the problem you would have other compilation errors).

aldo
  • 2,927
  • 21
  • 36