[問題] gcc編譯問題

看板Programming作者 (....)時間16年前 (2008/02/28 13:52), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
※ [本文轉錄自 C_and_CPP 看板] 作者: how0311 (....) 看板: C_and_CPP 標題: [問題] gcc編譯問題 時間: Thu Feb 28 10:55:02 2008 今天寫了一個test file但是在編譯的時候出現錯誤 不知道有沒有高手可以幫忙解決 test file 如下 test.c: // begine test file #include<iostream> using namespace std; typedef struct tt GTY(()){ // GTY為gcc中控制internal memory的機制 int i; }tt_t; int main(){ tt_t t; return 0; } // end test file 執行g++ test.cc後錯誤訊息如下 test.c: error: typedef `GTY' is initialized (use __typeof__ instead) test.c: error: expected primary-expression before ')' token test.c: error: expected `,' or `;' before '{' token test.c: error: declaration does not declare anything test.c: In function `int main()': test.c: error: aggregate `tt_t t' has incomplete type and cannot be defined -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.71.87

02/28 11:28,
去掉 GTY(()) ...
02/28 11:28

02/28 13:47,
如果一定要加GTY(())
02/28 13:47

02/28 13:47,
這個是gcc中控制internal memory的
02/28 13:47
-- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.71.87 ※ 編輯: how0311 來自: 140.114.71.87 (02/28 13:54)
文章代碼(AID): #17nameW8 (Programming)