0
所以我寫了一個清屏功能的代碼。我發現一切都稱使用詛咒庫函數來做到這一點,但我遇到了一個問題,當我不得不使用initscr()
給定的錯誤如下:架構的未定義符號initcscr
Undefined symbols for architecture x86_64:
"_initscr", referenced from:
_main in TheGame...I think.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
至於我可以告訴的最後兩行是對不同錯誤的引用,所以如果有人知道那是什麼會很好。 被拋出一個錯誤當前的代碼是:
#include <iostream>
#include <curses.h>
#include <ctime>
using namespace std;
int main(void){
//Initializations
initscr();
srand(static_cast<int>(time(0)));
menu();
return 0;
}
我知道,使用命名空間std是不好的做法,但是這是我的書告訴我這樣做,菜單引用while循環擴散到其他功能通過在curses.h
和initscr()
之前完美工作的用戶輸入,我已嘗試將void
和括號中的1到10之間的所有數字。 void引發一個解析的問題(Expected '(' for function-style cast or type construction
),而數字都使用推薦*initscr();
拋出相同的錯誤只是簡單initscr()
任何和所有幫助表示讚賞扔No matching function for call to 'initscr'
!
我懷疑''使用名稱空間標準;'是錯誤的原因在這裏。看起來你的ncurses庫是用c編譯器構建的,而你的'#includelude'周圍沒有'extern'C'{}'包裝。 –
2014-10-28 19:29:21
有沒有辦法解決這個問題,或者我應該嘗試找到一種完全不同的'clrscr'方式? – HadesHerald 2014-10-28 19:31:10
您是否已經檢查過[這個Q/A](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-doi-i-固定)。聽起來像你在這裏吠叫錯誤的樹。 – 2014-10-28 19:40:22