Linker抱怨“未解决的外部符号”
Linker complaining about “unresolved external symbol”
-
sequence_test.cpp
(测试调试器驱动程序)的完整代码 -
sequence2.cpp
(实现文件)的完整代码
这是头文件代码
#ifndef SEQUENCE_H
#define SEQUENCE_H
#include <cstdlib> // Provides size_t
namespace CISP430_A2
{
class sequence
{
public:
// TYPEDEFS and MEMBER CONSTANTS
typedef double value_type;
typedef size_t size_type;
enum { CAPACITY = 30 };
// CONSTRUCTOR
sequence(size_type entry=CAPACITY )
{
for(int i=0;i<CAPACITY;i++)
data[i]=0;
used=0;
capacity=CAPACITY;
current_index=0;
}
// COPY CONSTRUCTOR
sequence(const sequence& entry);
// Library facilities used: cstdlib
// MODIFICATION MEMBER FUNCTIONS
void start( );
void advance( );
void insert(const value_type& entry);
void attach(const value_type& entry);
void remove_current( );
void resize(size_type new_capacity);
void sequence::operator =(const sequence& entry);
// CONSTANT MEMBER FUNCTIONS
size_type size( ) const;
bool is_item( ) const;
value_type current( ) const;
//Destructor
~sequence(){}
private:
value_type data[CAPACITY];
size_type used;
size_type capacity;
size_type current_index;
};
}
#endif
我当前收到此链接器错误:
sequence_test.obj:错误LNK2019:未解析的外部符号"
public: __thiscall CISP430_A2::sequence::sequence(unsigned int)
"(??0sequence@CISP430_A2@@QAE@I@Z) 在函数_main
中引用
我刚刚尝试并成功编译了您的文件,所以它不在您的代码中(至少不在您发布的部分中)
我想,你在用Visual Studio吧?尝试以下
- 确保项目设置正确(项目中包含的所有文件?)
- 你使用预编译的头吗?试着把它们关掉
- 尝试干净的重建
相关文章:
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 未解析的外部符号_MsiLocateComponentW@12.
- 在C++中使用 gRPC 时未解析的外部符号
- LibPrivoxy: 未解析的外部符号 __declspec(dllimport) int __stdcall Sta
- 尝试从 XamlApplication 编译 C++/WinRT 空白应用程序时,我收到未解析的外部符号 winrt_make_*
- 我收到错误LNK2001:未解析的外部符号(C++代码)
- 可视抽象类 c++(错误 LNK 2001:未解析的外部符号)
- 如何摆脱C++中未解析的外部符号"private: static char"错误?
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 仅在少数方法(静态或共享库)中解析的外部符号
- 未解析的外部符号"__declspec(dllimport)与 Spdlog c++ 库
- 函数 _main (OPENGL C++) 中引用的未解析的外部符号 ________
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- 使用静态 constexpr 成员的未解析外部符号
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- Dlib LNK2001未解析的外部符号USER_ERROR__consistent_build_configurati
- 矛盾的未解决的外部符号+未使用的库与VS2017和FFMPEG 4
- 链接器错误:切换到unicode生成给出:未解析的外部符号WinMain
- 类模板上一个特定函数的未解析外部符号
- LNK2001:未解析的外部符号public:static类std::vector