【发布时间】:2013-05-27 21:17:40
【问题描述】:
我已经寻找解决我的问题的方法,但发布的那些似乎不起作用。我正在尝试在 Visual Studio 2012 中运行以下内容。我以前使用 Eclipse 进行编程,现在正在适应新的 IDE。
class
IntSLLNode{
public:
int info;
IntSLLNode *next;
IntSLLNode(){
next = 0;
}
IntSLLNode (int el, IntSLLNode *ptr= 0) {
info = el;
next = ptr;
}
};
int main(){
#include <iostream>
using namespace std;
IntSLLNode *p = new IntSLLNode(18);
cout << *p;
return;
}
当我尝试运行它时,它在 cout 下给了我一个错误。我像往常一样包含了 iostream 和 std 命名空间。这不正确吗?任何人都可以帮助我让它工作,因为我非常喜欢 Visual Studio IDE 的外观并希望继续使用它。
【问题讨论】:
-
如果你编辑你的问题添加你从你的IDE得到的错误信息会更好
-
另请注意,“
using namespace std”比std::包含更多字符,因此在这种情况下,它甚至不会为您节省任何输入。 -
很确定这也不会在 Eclipse 中编译。