我是編程初學者,自己在網上查到的解釋都不能理解。。。貼出源代碼有人幫忙看看 謝謝了
1.To C or not to C
#include <stdio.h>
int main(void){
printf("To C or not to C; that is a question.");
getchar();
return(0);
}
2.dwight
#include <stdio.h>
int main(void){
int height, length, width, volume, weight;
height = 18;
length = 12;
width = 23;
volume = height * length * width;
weight = (volume + 165) / 166;
printf("Dismensions: %dX%dX%d\n", length, height, width);
printf("Volume(Cubic inches): %d\n", volume);
getchar();
return(0);
}
編譯錯誤提示是:
1>------ 已啟動生成: 專案: Project1, 配置: Release Win32 ------
1> dwight.cpp
1> to c or not to c.cpp
1>to c or not to c.obj : error LNK2005: _main 已經在 dwight.obj 中定義
1>d:\Personal\documents\visual studio 2013\Projects\Project1\Release\Project1.exe : fatal error LNK1169: 找到一個或多個多重定義的符號
========== 生成: 成功 0 個,失敗 1 個,最新 0 個,跳過 0 個 ==========
謝謝各位
uj5u.com熱心網友回復:
一個工程里只能有一個入口main函式。你把這兩個單元放在兩個工程中就可以了uj5u.com熱心網友回復:
這么基礎的錯誤不應該犯啊。轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/104384.html
標籤:基礎類
上一篇:android布局XML屬性能力增強(圓角、虛線、邊框等)
下一篇:圖片的比較
