简体   繁体   English

编译期间无法解决的外部错误

[英]Unresolved externals error during compilation

I am getting two unresolved externals error while trying to compile the following c++ program in Visual Studio 2010- http://codepad.org/5ZS4gtfP 尝试在Visual Studio 2010中编译以下c ++程序时遇到两个无法解决的外部错误-http ://codepad.org/5ZS4gtfP

I tried cross checking everything but cant seem to find the problem. 我尝试对所有内容进行交叉检查,但似乎找不到问题。 Can someone plz compile it in VS 2010 and try to find out the solution? 有人可以在VS 2010中对其进行编译并尝试找出解决方案吗?

For a start, conio.h is not standard C or C++ - it tends to be found in code written for the Turbo C/C++ products, a particular favourite of Indian universities. 首先, conio.h不是标准的C或C ++-它通常在为Turbo C / C ++产品编写的代码中找到,这是印度大学特别喜欢的。

And they invariably use it just so they can call getch when there's a perfectly adequate getchar in the standard :-) 他们总是使用它,以便在标准中有足够足够的getchar时可以调用getch :-)

As to the index variable, it's probably already defined in one of the headers. 至于index变量,它可能已经在头文件之一中定义了。

  • Line 18: error: conio.h: No such file or directory: 第18行:错误:conio.h:没有这样的文件或目录:

Try to include <conio.h> instead of "conio.h" . 尝试包含<conio.h>而不是"conio.h"

  • Line 25: error: 'unsigned int index' redeclared as different kind of symbol: 第25行:错误:“ unsigned int index”重新声明为另一种符号:

It could be that one of the headers you're including already declares index . 您可能包含的标头之一已经声明了index Try to rename it to see the difference - or better yet don't use a global variable at all. 尝试重命名它以查看差异-或更好的是根本不使用全局变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM