小编Cra*_*aig的帖子

双重链接列表:未解决的外部因素

可能重复:
为什么模板只能在头文件中实现?
什么是未定义的引用/未解析的外部符号错误,我该如何解决?

这是一个家庭作业,我的导师给了我们很多反馈,但我仍然对这个编译问题感到迷茫.

当我将main函数放在实现文件中时,程序编译并完美地工作.但是,当我将main函数放入main.cpp时,编译器会抱怨:

 unresolved external symbol "public: __thiscall doublyLinkedList<int>::doublyLinkedList<int>(void)" (??0?$doublyLinkedList@H@@QAE@XZ) referenced in function
Run Code Online (Sandbox Code Playgroud)

头文件

#ifndef H_doublyLinkedList
#define H_doublyLinkedList

#include <iostream>
#include <cassert>

using namespace std;

//Definition of the node
template <class Type>
struct nodeType
{  
   Type info;
   nodeType<Type> *next;
   nodeType<Type> *back;  
};

template <class Type>
class doublyLinkedList
{
public:
const doublyLinkedList<Type>& operator=
                       (const doublyLinkedList<Type> &);
  //Overload the assignment operator.

void initializeList();
  //Function to initialize the list to an empty state.
  //Postcondition: first = NULL; last = NULL; count …
Run Code Online (Sandbox Code Playgroud)

c++

5
推荐指数
1
解决办法
1552
查看次数

Powershell - 处理 Windows 窗体事件

作为一名后端脚本编写者/开发人员,我对 .net 的熟悉程度不如我是一名 jr 软件工程师时那么熟悉。但是,我喜欢指标,并且有想法为我的 vpn、cpu 和 ram 使用情况编写网络监视器,因为某些站点导致 google 内存泄漏,直到我在 cpu 和 ram 上达到 99% 时我才注意到它

所以我有这个脚本,我决定也尝试制作一个 gui,因为你知道现在每个人都想要一个全栈开发人员。

我一生都无法找出如何让计时器和事件对象在表单加载时触发以创建我的准无限循环

我一直在使用这个源来了解事件计时器和注册的 objectevent

########################################################################
# Modified by Derek from source below. All I did was the psexec query and cleaned it up a bit.
# Original basis for gui updating created by:
# Code Generated By: SAPIEN Technologies, Inc., PrimalForms 2009 v1.1.10.0
# Generated On: 23/10/2010 08:37
# Generated By: KST
# http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/780aaa2e-4edf-495b-a63e-d8876eab9b25
########################################################################
function OnApplicationLoad {
    return $true …
Run Code Online (Sandbox Code Playgroud)

.net powershell winforms

3
推荐指数
1
解决办法
3660
查看次数

Double Linked List标头节点将第一个值保持为0

我将序言说这是我的第一个问题.我目前正在获得信息安全硕士学位,这个学期我不得不参加C++编程.所以这是与家庭作业有关的.我不是在找你回答我的作业,但我遇到了一个特殊的情况.我创建了程序以使用双向链表,一切正常.但是,当我让用户创建一个值列表时,第一个节点一直返回0.我已经尝试找到一些读数,我找不到任何对它的引用.我的问题是标题节点(第一个节点)总是为零?或者我做错了什么.

case: 'C':
 cout<<"Please enter a list:"<<endl;
  while(n!=-999){
     myList.insert(n);
     cin>> n;}
  break;
Run Code Online (Sandbox Code Playgroud)

我现在输入:12321,1234,64564,346346.结果在0,12321,1234,64564,346346.这是应该发生的事情还是我做错了什么?另外,由于这是我的第一篇文章,请随时批评或教我如何对关键字进行颜色编码.

无论如何这是一个家庭作业,所以我只是寻求指导和建设性的批评.

谢谢大家

所以我无法弄清楚这个论坛上的评论部分,所以我将编辑原帖.第一部分是构造函数代码:

template <class Type>
 doublyLinkedList<Type>::doublyLinkedList()
  {
    first= NULL;
    last = NULL;
    count = 0;
      }
Run Code Online (Sandbox Code Playgroud)

然后是我的插入功能:

template <class Type>
void doublyLinkedList<Type>::insert(const Type& insertItem)
 {
nodeType<Type> *current;      //pointer to traverse the list
nodeType<Type> *trailCurrent; //pointer just before current
nodeType<Type> *newNode;      //pointer to create a node
bool found;

newNode = new nodeType<Type>; //create the node
newNode->info = insertItem;  //store the new item in the node
newNode->next = …
Run Code Online (Sandbox Code Playgroud)

c++

1
推荐指数
1
解决办法
866
查看次数

标签 统计

c++ ×2

.net ×1

powershell ×1

winforms ×1