0

I am attempting to run an old program that uses tcl as well as legacy opengl. I managed to link the opengl libraries successfully; however, I cannot seem to get the tcl linker to work. For context, the program I am using came with include and lib folder. The lib folder contains tclstub86_32.lib, tclstub86_64.lib, and tkstub86.lib as well as opengl .libs. The include folder contains two folders: tcl_include and tk_include, which obviously contain all the .c and .h files for tcl and tk. The following pictures show my settings from using project -> build options: enter image description here

enter image description here

enter image description here

The error I receive when compiling is:

C:\Users\amlut\Downloads\C\tkogl\curve.c|18|undefined reference to `_imp__Tcl_Free'|

And here is the bit of code that is throwing the error:

if (*line != NULL) Tcl_Free((char*)*line);

I am not sure what I am doing wrong here, any help is appreciated. Thank you.

hkj447
  • 677
  • 7
  • 21

1 Answers1

1

The problem is that the code is apparently linking against the Tcl stub library (an ABI/API adaptor library) but isn't compiling to use that library but rather to use a full Tcl library instead. When building an extension package, using the stub library is a good thing as it means that the resulting code is not bound to an exact version of the Tcl (and Tk) library but rather to a version of the Tcl ABI which has a much longer support cycle.

The fix is to define the USE_TCL_STUBS and USE_TK_STUBS (that has the identical issue; you have just hit the Tcl version of it first) C preprocessor symbols when building; set them both to 1 and recompile. This is done under the Compiler Settings tab in Code::Blocks apparently.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Thank you for your response. However, it appears even with `#defines` specified, it still throws the compiler error. Are there any other avenues I should pursue? – hkj447 Sep 16 '19 at 14:11
  • Update: I added the `#defines` directly to the `tcl.h` header, and while the error went away, I get another error that states "No such file or directory". – hkj447 Sep 16 '19 at 14:26
  • Editing the `tcl.h` header file is _not_ the way to do this! – Donal Fellows Sep 16 '19 at 18:55
  • BTW, I don't actually understand the state of your system any more, but if you're doing things like editing header files provided by others, any answers that fully fix things for you are _extremely_ unlikely to apply to anyone else. – Donal Fellows Sep 17 '19 at 08:12
  • That was the only time I edited a header file, I deleted that one line to make it normal again. Though, it runs into the same error of not being able to identify any TCL/TK functions. – hkj447 Sep 18 '19 at 00:17
  • Assuming all the proper header files are intact, are there any other avenues I could explore to solve this issue? – hkj447 Sep 18 '19 at 14:40