Including tk.h and tcl.h in the c program

I am working on an ubuntu system. My goal is to basically create a C IDE using the GUI tools from TCL / TK. I installed tcl 8.4, tk8.4, tcl8.4-dev, tk8.4-dev and have tk.h and tcl.h header files on my system. But, when I run the basic welcome program, it shows a lot of errors.

#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);
}

Some of the errors are:

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 parameterTkStubs
tkDecls.h:1201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

/usr/include/stdio.h:145: error: storage class specified for parameterstdin

tk.h:1273: error: declaration for parameter ‘Tk_PhotoHandle’ but no such parameter

Can anyone tell me how can I fix these errors? Please, help...

+3
source share
2 answers

. , , Tcl Tk C. Tcl/Tk Tcl Wiki ( 1).

Tcl Tk Tcl_Interp. , , Tcl . Tk . Tcl_AppInit , tclAppInit.c Tcl ( tkAppInit.c Tk) , . tkAppInit "" Tcl_AppInit, Tcl Tk.

Tk C . Tk Tcl. Tk Tcl ( library/*.tcl).

+4

... <> ?! button("..") -text("...") .. C, tk.h button -text ( , .. ), , ( )...

this, ; ( ), , . this

0

Source: https://habr.com/ru/post/1749152/


All Articles