subject_37132.htm

来自「一些关于vc的问答」· HTM 代码 · 共 12 行

HTM
12
字号
<p>
序号:37132 发表者:ninekwll 发表日期:2003-04-22 10:08:14
<br>主题:编译时的链接错误
<br>内容:我的程序在链接时发生错误:<BR>LNK2005和LNK1169.<BR>上面显示的是多次定义,请高手解释一下!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:neilgan 回复日期:2003-04-22 10:45:15
<br>内容:VC compiler will also show you what's the redefined symbol. Use "VC-&gt;Edit-&gt;Find in files..." to search for all the existences of this symbol, be sure that you defined it only once.<BR><BR>One reason for this error is that you declared a global variable in a .h file and include this file in several .cpp files. Don't declare global variables in .h files. Declare it in a .cpp file and use "extern VarType VarName;" in a .h file to export the variable.<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?