未解决的外部符号 - 来自其他项目的静态函数
unresolved external symbol - calling static function from other project
我有两个项目 - proj_1
, proj_2
。
proj_1
是LIB项目,proj_2
是常规项目
在 proj_2
中,我的功能名为 static void proj_2_func()
。我试图从 proj_1
调用该函数(无需创建对象),但我会得到链接错误-unresolved external symbol
。
proj_2:
class proj_2_class
{
public:
static void proj_2_func(); //the implementation is not relevant
}
proj_1:
in cpp file:
#include proj_2_class.h // I added the path to "additional include files" in proj_1
void proj_1_class::proj_1_func()
{
proj_2_class::proj_2_func();
}
很高兴为该错误提供指导。
谢谢。
因为您的函数proj_1_class::proj_1_func
调用函数proj_2_class::proj_2_func
,后者需要在某个地方提供实现 - 不这样做是导致链接器错误
相关文章:
- 相同的 for 循环适用于其他项目,但不适用于此项目。为什么?
- 来自 Omnet++ 中其他项目的引用标头
- 在 Eclipse 中漂亮的打印C++适用于某些项目,而不适用于其他项目
- 创建并编译基类以在其他 C++ 项目 (ROS) 中使用
- 相同的代码,不同的结果?从其他项目包含有什么问题?
- Cmake:制作静态库并在其他项目中使用
- 视觉C++ 引用其他项目中的文件
- 在其他项目的派生类中,在LNK2001中未出现的虚拟函数在LNK2001中产生
- 未解决的外部符号 - 来自其他项目的静态函数
- 仅项目 -> 仅清理 项目正在清理 Visual Studio 2012 中的其他项目
- 包括来自其他项目的源文件的最佳实践
- 如何在其他C 项目中添加本机项目并使用本机功能
- 您可以将链接器/其他依赖项等复制到其他项目吗?
- CMake-在我的当前项目中使用我的其他项目代码
- 如何在同一解决方案中包含其他项目的头文件
- 第三方库抱怨MAXPATHLEN没有在一个项目中声明,但在其他项目中没有声明
- 在QStringList中搜索特定项目,然后搜索可能包含项目的其他项目
- 包括来自其他项目的文件
- 链接项目,其中我使用来自其他项目的静态成员
- 虚函数的定义没有在其他项目中找到