简体   繁体   中英

Codeblocks not recognizing tcl library

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: 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM