我正在使用ubuntu系統。我的目標是基本上使用TCL/TK的GUI工具製作C語言IDE。我安裝了tcl 8.4,tk8.4,tcl8.4-dev,tk8.4-dev,並在我的系統中安裝了tk.h和tcl.h頭文件。但是,當我運行一個基本的Hello World程序時,它顯示了很多錯誤。在c程序中包含tk.h和tcl.h
#include "tk.h"
#include "stdio.h"
void hello() {
puts("Hello C++/Tk!");
}
int main(int, char *argv[])
{ init(argv[0]);
button(".b") -text("Say Hello") -command(hello);
pack(".b") -padx(20) -pady(6);
}
有些錯誤是
tkDecls.h:644: error: expected declaration specifiers before ‘EXTERN’
/usr/include/libio.h:488: error: expected ‘)’ before ‘*’ token
In file included from tk.h:1559,
from new1.c:1:
tkDecls.h:1196: error: storage class specified for parameter ‘TkStubs’
tkDecls.h:1201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/stdio.h:145: error: storage class specified for parameter ‘stdin’
tk.h:1273: error: declaration for parameter ‘Tk_PhotoHandle’ but no such parameter
誰能告訴我怎樣才能糾正這些錯誤?請幫助...
顯示一些選定的錯誤沒有意義。幾乎總是,只有編譯器的第一個錯誤纔是信息性的,因爲所有其他錯誤都是後續錯誤。大多數情況下,第一個錯誤非常清楚地說明出了什麼問題。那麼REAL輸出是什麼? – 2010-06-09 06:24:05
tcl完全可以從'c'調用 - 這可能是您的設置中的錯誤。你使用的是什麼操作系統和編譯器? – 2011-02-21 18:42:03
C或C++?選一個。 – 2015-12-22 17:46:36