51Testing软件测试论坛

标题: 老师同学们来帮我解决一个问题 [打印本页]

作者: 7265695    时间: 2006-5-10 17:03
标题: 老师同学们来帮我解决一个问题
我集成测试环境搭建过程中遇到这个错误:
Linking...
test.obj : error LNK2005: "int g_iBlankLineNum" (?g_iBlankLineNum@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_iCodeLineNum" (?g_iCodeLineNum@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_iCommLineNum" (?g_iCommLineNum@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_iTotalLineNum" (?g_iTotalLineNum@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_bStatBlankLineFlag" (?g_bStatBlankLineFlag@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_bStatCodeLineFlag" (?g_bStatCodeLineFlag@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_bStatCommLineFlag" (?g_bStatCommLineFlag@@3HA) already defined in countertest.obj
test.obj : error LNK2005: "int g_bStatTotalLineFlag" (?g_bStatTotalLineFlag@@3HA) already defined in countertest.obj
Debug/countertest.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.

countertest.exe - 1 error(s), 0 warning(s)

该怎么解决呀?
作者: tyf    时间: 2006-5-11 09:03
我估计是g_iBlankLineNum,g_iCodeLineNum,g_iCommLineNum,g_iTotalLineNum,g_bStatBlankLineFlag,g_bStatCodeLineFlag,g_bStatCommLineFlag,g_bStatTotalLineFlag这8个变量在不同的地方被定义了多次,你找一下。如果前一个地方定义了,后一个地方用extern 引用一下就行了,例如:extern int  g_iBlankLineNum;
作者: 7265695    时间: 2006-5-12 12:42
我没学过C++  不知道是怎么回事   我试一下  谢谢楼上的




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2