发生了一些奇怪的事情。使用MVS 2013年C++:有两个相同的函数,一个给出错误。发生什么事?
Filename.cpp
#include "Functions.h"
int main()
{
introInformation();
introInformation2();
}
Functions.cpp
void introInformation()
{
//A bunch of couts telling the user how to play the game.
}
void introInformation2()
{
//A bunch of couts telling the user how to play the game.
}
当introInformation2()被调用主。 MVS给出错误:'introInformation2':标识符未找到。但为什么只有第二?一切似乎都是一样的。
更奇怪的是,当我做一个函数声明上面主要只是introInformation2()一切正常。但是同时没有introInformation()的声明。
我注意到,如果我将introInformation()的名称更改为introInformation1()(是的,在函数调用和定义中),我会得到相同的错误。 MVS似乎被设置为以前的名字。
我有一个轻微的怀疑,这是因为我复制粘贴这个原始项目,并在不改变粘贴项目的文件夹名称的情况下进行可能的更改。那个新项目已被删除。
'Functions.h'的内容是什么? – Vlad
您向我们显示的代码是正确的。错误在你没有显示的代码中。 –
'Functions.h'的内容是什么?它是否声明'introInformation()'? – Jarod42