nomad-software / tkd

GUI toolkit for the D programming language based on Tcl/Tk
MIT License
117 stars 16 forks source link

lib found but undefined references #44

Closed nyovaya closed 6 years ago

nyovaya commented 6 years ago

I havent got much experience with D yet but I got these undefined references - the library should be properly included. https://pastebin.com/neWNdVN3 What am I doing wrong?

nomad-software commented 6 years ago

Looks like you're not compiling all the used modules, only your main source file. This is the linker basically saying that it can't find the code for everything used in the main function.

When compiling a D program, you have to compile all the imported modules (and all the modules they import) as well as the one containing the main function. Once they are all compiled into object files (*.o extension) the linker links them together into a program. The linker's job is to link up the code in each of the modules. In your case it can't find some of them leading me to believe you haven't compiled them or that the linked doesn't know about them.

See the rdmd tool to recursively compile all imported modules.

nyovaya commented 6 years ago

Then Ill ask somewhere else how to do this.

nomad-software commented 6 years ago

You can get some great help here: http://forum.dlang.org/group/learn

nomad-software commented 6 years ago

You can use rdmd to simplify the process. A typical command line to compile a tkd application would looki like this:

rdmd --force -de -debug -I~/tkd/source -I~/tcltk/source -I~/x11/source -L=-ltcl -L=-ltk -L=-lX11 -w main.d
nyovaya commented 6 years ago

Ok - I was mostly able to build it with this ld main.o libtkd.a -ltk8.6 -ltcl8.6 -lX11 -o main but I have an undefined reference to fputc_unlocked from libtkd.a.