老师同学们来帮我解决一个问题
我集成测试环境搭建过程中遇到这个错误: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)
该怎么解决呀? 我估计是g_iBlankLineNum,g_iCodeLineNum,g_iCommLineNum,g_iTotalLineNum,g_bStatBlankLineFlag,g_bStatCodeLineFlag,g_bStatCommLineFlag,g_bStatTotalLineFlag这8个变量在不同的地方被定义了多次,你找一下。如果前一个地方定义了,后一个地方用extern 引用一下就行了,例如:extern intg_iBlankLineNum; 我没学过C++不知道是怎么回事 我试一下谢谢楼上的
页:
[1]