亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

學習c++的新手遇到問題,求大神幫個忙

學習c++的新手遇到問題,求大神幫個忙

C++
白板的微信 2018-07-11 15:26:17
我代碼是這樣的: #include <iostream> using namespace std; int result(int, int); const int k = 2; struct  Point{     int x , y; }; int main() {     int z(0), b(50); Point a; cout << "輸入兩個整數(以空格區分):"; cin >> a.x >> a.y; z = (a.x + a.y) * k; z = result(z, b); cout << "計算結果如下:" << endl; cout << "((" << a.x  << " + " << a.y << " ) * " << k << ")+" << b          << "=" << z          << endl; return 0; } 但是報錯了:Scanning dependencies of target cpp[ 50%] Building CXX object CMakeFiles/cpp.dir/main.cpp.o[100%] Linking CXX executable cppUndefined symbols for architecture x86_64:"result(int, int)", referenced from:_main in main.cpp.old: symbol(s) not found for architecture x86_64collect2: error: ld returned 1 exit statusmake[3]: *** [cpp] Error 1make[2]: *** [CMakeFiles/cpp.dir/all] Error 2make[1]: *** [CMakeFiles/cpp.dir/rule] Error 2make: *** [cpp] Error 2
查看完整描述

1 回答

?
千萬里不及你

TA貢獻1784條經驗 獲得超9個贊

你 result 函數定義呢?只有聲明沒有定義,怎么調用

查看完整回答
反對 回復 2018-07-21
  • 1 回答
  • 0 關注
  • 869 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號