compile通过,但excute是出现错误,这两个之间有什么区别?
出现错误提示是什么愿因?
    f:\sourcecode\c++\datastructure\chapter3\linklist.cpp(63) : error  C2440: '=' : cannot convert from 'class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)' to 'class LinkNode<int> *'
    There is no context in which this conversion is possible
    d:\program files\microsoft visual studio\vc98\include\xmemory(59) : while compiling class-template member function 'void __thiscall 
有没有vc6.0针对编译的入门书籍?
vc6的补丁在哪儿可下载?

解决方案 »

  1.   

    "有没有vc6.0针对编译的入门书籍?" v.s. "vc6的编译是不是存在问题?怎么老出莫名奇妙的问题?"
    你提的问题好大!!!
      

  2.   

    compile通过说明你的程序语法没有错误,execute出错是在内存中运行时出错,归根到底应该是你的程序有问题,当然也有系统出错的可能。
    《C++程序调试》一书应该可以让你入门,里面用的是Visual C++ 6.0
      

  3.   

    初用vc,老感觉vc6编译老出问题,本来没问题的程序,稍微改了一点,结果出来一大堆的error,这是不是vc6的一贯的作风?
     楼上四座山峰的老大,能不能帮个忙,解释一下原因?给个链接也可。
      

  4.   

    多谢hhdlotus(荷花淀) !
      

  5.   

    还是要学会从MSDN中找到解决问题的方法
      

  6.   

    出了错,你可以选中错误号然后按F1,就会了解到出错的具体情况。当然你必须要安了MSDN,没有MSDN想用好VC是不可能的。
      

  7.   

    cannot convert from 'class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)' to 'class LinkNode<int> *'
    class LinkNode<int> *(__thiscall LinkNode<int>::*)(void)
    是一个函数指针
    class LinkNode<int> *显然不是,两者不能转换。
    再仔细查查代码吧。
      

  8.   

    的确编译过了,代码如下(单向链表):
    // LinkList.h: interface for the LinkList class.
    //
    //////////////////////////////////////////////////////////////////////#if !defined(AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_)
    #define AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    #include "..\stdafx.h"template <typename elemType> class LinkList;template <typename elemType> class LinkNode
    {
    friend class LinkList<elemType>;
    public:
    LinkNode(const elemType elem):data(elem),nextNode(0) {};
    LinkNode(const LinkNode *n):data(n->data),nextNode(0){};
    virtual ~LinkNode();
    inline LinkNode<elemType> *NextNode() {return nextNode;}
    inline elemType &GetData() {return data;}
    private:
    elemType data;
    LinkNode<elemType> *nextNode;
    };template <typename elemType> class LinkList  
    {
    public:
    LinkList();
    virtual ~LinkList(); void Insert(const elemType &,const int &);
    LinkNode<elemType>  *GetFirst() {return first;}
    LinkNode<elemType>  *Find(elemType &);
    void Delete(const int &i);
    int Length() {return length;}

    private:
    int length;
    LinkNode<elemType> *first;
    };#endif // !defined(AFX_LINKLIST_H__A9A55711_40F0_47B0_9B15_EACDB6F9AC7A__INCLUDED_)
      

  9.   

    // LinkList.cpp: implementation of the LinkList class.
    //
    //////////////////////////////////////////////////////////////////////
    #include <iostream>
    #include <string>
    using namespace std;
    #include "..\stdafx.h"
    #include "LinkList.h"
    //////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////
    template <typename elemType>
    LinkList<elemType>::LinkList():first(0)
    {

    }
    template <typename elemType>
    LinkList<elemType>::~LinkList()
    {

    }template <typename elemType>
    void LinkList<elemType>::Insert(const elemType &elem,const int &index)
    {
    LinkNode<elemType> *p = first; int k = 0;
    while ((p != 0) && (k < index -1)) 
    {
    p = p->NextNode;
    k ++;
    } if ((p == 0) && (first != 0))
    {
    cout << ("out range of array") << endl;
    //return 0;
    }
    /*
    LinkNode<elemType> *newNode = new LinkNode<elemType>(elem);
    if ((first == 0) || (index == 0))
    {
    newNode->NextNode = first;
    first = newNode
    }
    else
    {
    newNode->NextNode = p->NextNode;
    p->NextNode = newNode;
    }
    */
    }template <typename elemType>
    LinkNode<elemType> *LinkList<elemType>::Find(elemType &elem)
    {
    LinkNode *temp = first->NextNode;
    while (temp != 0)
    {
    if (elemType == temp.data)
    {
    break;
    }
    temp = temp->NextNode;
    }

    return temp;}template <typename elemType>
    void LinkList<elemType>::Delete(const int &index)
    {
    return;
    }
      

  10.   

    提示上面的while中的语句error,
    while ((p != 0) && (k < index -1)) 
    {
     p = p->NextNode;          --这一句提示错误的,但编译通过
     k ++;
    }