vc++ 编译时发生错误 帮忙谢谢 急急急急急急急急

来源:百度知道 编辑:UC知道 时间:2024/05/15 22:41:00
#include<iostream>
using namespace std;
main(void){
for(int i=1;i<=10;++i){
for(int j=1;j<=10-i;++j)
cout<<" ";
for(int ch='A';ch<='A'+2*j-1;++ch)
cout<<ch;
cout<<"\n";

}
}
错误如下:
--------------------Configuration: 123 - Win32 Debug--------------------
Linking...
beautiful pictures.obj : error LNK2005: _main already defined in 123.obj
Debug/123.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.

123.exe - 1 error(s), 0 warning(s) 这是为什么啊 帮忙谢谢
main函数 是主控函数 难道我每次写一个函数就定义一个工程啊 晕倒 你怎么分析问题的

main函数只能有一个嘛,他的意思就是说main函数在你以前写过的123这个文件里定义过了,你在my project文件夹里可以找到123这个文件
<br>要新建一个工程吧
-----------------------------------------
因为它会把123给link起来嘛,不会错吧,不信你把123这个文件移走,然后再试试

123这个工程已定义了