我只是有一个问题,我一直在尝试解决最长时间。
我有一个 Visual c++ 中的静态库项目,我希望另一个项目能够链接到它。到目前为止,我只是添加了对静态库项目的引用,它会自动链接库。
我希望能够仅使用头文件和 .lib 文件链接到库。但是,我收到“未解析的外部符号”错误。
我认为我做得对 - 我指定了包含目录、库目录,并进入链接器输入属性并将 lib 作为附加依赖项提供。
我可以通过这种方式引用其他静态库(如 SDL),那么为什么在尝试引用我的库时会出错?
谢谢您的帮助。
问题是它没有引用实际的 lib 文件,还是 lib 本身的问题?这些是我收到的错误消息:
错误 2 错误 LNK2019:无法解析的外部符号“public: void __thiscall XEngine::XCore::XScreen::init(class XEngine::XCore::XGame &)”(?init@XScreen@XCore@XEngine@@QAEXAAVXGame@23@ @Z) 在函数“void __cdecl XEngine::XEngineInit(class XEngine::XCore::XScreen &,class XEngine::XCore::XGame &)”中引用 (?XEngineInit@XEngine@@YAXAAVXScreen@XCore@1@AAVXGame@ 31@@Z) C:\Users\Xander Masotto\Documents\Visual Studio 2010\Projects\Pong\Pong\source.obj Pong
错误 3 错误 LNK2019:未解析的外部符号“public: __thiscall XEngine::XCore::XScreen::~XScreen(void)”(??1XScreen@XCore@XEngine@@QAE@XZ) 在函数“void __cdecl XEngine:: XEngineInit(class XEngine::XCore::XGame &)" (?XEngineInit@XEngine@@YAXAAVXGame@XCore@1@@Z) C:\Users\Xander Masotto\Documents\Visual Studio 2010\Projects\Pong\Pong\source .obj 乒乓
错误 4 错误 LNK2019:未解析的外部符号“public: __thiscall XEngine::XCore::XScreen::XScreen(void)”(??0XScreen@XCore@XEngine@@QAE@XZ) 在函数“void __cdecl XEngine::XEngineInit”中引用(class XEngine::XCore::XGame &)" (?XEngineInit@XEngine@@YAXAAVXGame@XCore@1@@Z) C:\Users\Xander Masotto\Documents\Visual Studio 2010\Projects\Pong\Pong\source.对象乒乓