I was trying to build the simplest PPAPI plugin with Visual Studio, and it gave several LNK2001: unresolved external symbol and LNK2019: unresolved external symbol errors, all of them about PPAPI methods, such as LNK2001 unresolved external symbol "public: virtual void __cdecl pp::Instance::DidChangeView(class pp::View const &)" (?DidChangeView@Instance@pp@@UEAAXAEBVView@2@@Z), and LNK2019 unresolved external symbol "public: __cdecl pp::Instance::Instance(int)" (??0Instance@pp@@QEAA@H@Z) referenced in function "public: __cdecl MyInstance::MyInstance(int)" (??0MyInstance@@QEAA@H@Z)
".
All the errors are depicted in this screenshot
Current code of the plugin is below:
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <stdint.h>
#include <windows.h>
#include <tchar.h>
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
// This is the simplest possible C++ Pepper plugin that does nothing.
// This object represents one time the page says <embed>.
class MyInstance : public pp::Instance {
public:
explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {}
virtual ~MyInstance() {}
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
return true;
}
};
// This object is the global object representing this plugin library as long
// as it is loaded.
class MyModule : public pp::Module {
public:
MyModule() : pp::Module() {}
virtual ~MyModule() {}
// Override CreateInstance to create your customized Instance object.
virtual pp::Instance* CreateInstance(PP_Instance instance) {
return new MyInstance(instance);
}
};
namespace pp {
// Factory function for your specialization of the Module object.
Module* CreateModule() {
return new MyModule();
}
} // namespace pp
I tried removing everything in the namespace pp big parentheses, and Visual Studio didn't report an error when I compiled it again. But of course, this is not a solution. The plugin can't be loaded if I compiled it like that.
So the question is, how do I solve this error?
If anyone knows, please help. I was stuck on this problem for days now. Thank you very much if you can answer!