Visual Studio C ++中的多个无法解释的语法错误

时间:2016-09-06 03:40:34

标签: c++ visual-studio-2010

我在VS2010上收到了很多不必要的语法错误,我不知道它们来自哪里。以下是收到的一些错误

enter image description here

虽然实际上还有更多。这个特定的文件是我从我工作过的人那里收到的,它在他们的系统上运行得很好,因此它不应该是代码,无论我是否附加了以下代码片段的一部分这包括一些我不理解的语法错误:

#include "stdafx.h"
#pragma once
//#include "TwoToFourTree.h"


template<class ItemType>

TwoToFourTree<ItemType>::TwoToFourTree()
{
    rootPtr = new QuadNode<ItemType>();
}//Default

template<class ItemType>
TwoToFourTree<ItemType>::TwoToFourTree(const ItemType& anItem)
{
    rootPtr = new QuadNode<ItemType>(anItem);
} // Default with item

template<class ItemType>
TwoToFourTree<ItemType>::~TwoToFourTree()
{
} // Destructor(needs removal function to be finished)

template<class ItemType>
QuadNode<ItemType>* TwoToFourTree<ItemType>::getRootPtr()
{
    return rootPtr;
}  // Returns root pointer

图像中的第8行从第一个方法声明(默认构造函数)开始。是否有可能导致所有这些废话的设置?我到处搜索,我不知道如何处理这个问题。

2 个答案:

答案 0 :(得分:0)

TwoToFourTree.h的#include指令已被注释掉,这可能是定义了TwoToFourTree类的文件。尝试取消注释该行。

答案 1 :(得分:0)

他可能将其从本地目录中删除了...与intellj scala程序或Visual Studio一样...文件必须放在附近..像c:/ users /“桌面名称” /文档那样,您的桌面文件夹在大多数情况下,对于Scala程序,您必须在项目结构中添加库路径,或者在vs CLR C ++控制台中,单击主要路径进入project-> properties-> code Generation ...进行文件构建/调试