gpt4 book ai didi

c++ - 未解析的外部符号 (LNK2019)

转载 作者:行者123 更新时间:2023-11-28 03:27:22 25 4
gpt4 key购买 nike

<分区>

我有以下文件:
接口(interface).h

class Interface
{
...
};

Interface* CreateInterface();

实现.h

#include "interface.h"

class Impl: public Interface
{
...
};

实现.cpp

#include "impl.h"

SomeInterface* CreateInterface()
{
return new Impl;
}
...

主要.cpp

#include "Interface.h"
int main()
{
CreateInterface();
}

最初我的项目看起来很喜欢 this .但出于测试目的,所有文件现在都在同一个项目中。
编译时出现 LNK2019 错误,提示 CreateInterface 未解析。我正在使用 VS 2008,我不知道出了什么问题。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com