On Mon, 20 May 2019 at 12:50, D_Boy via D.gnu <d.gnu@puremagic.com> wrote: > > On Monday, 20 May 2019 at 08:01:01 UTC, D_Boy wrote: > > I am following Ali Çehreli's book. It says that stdout.write() > > should work the same as write() > > > > In DMD it works. But when trying to compile with GDC I get the > > following error: > > > > gdc anApp.d -o anApp && ./anApp > > /usr/bin/ld: /tmp/cc5zJLcW.o: in function `_Dmain': > > anApp.d:(.text+0x32): undefined reference to > > `_D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File' > > collect2: error: ld returned 1 exit status > > > > > > Could you please tell me what could be wrong? > > > > I am using DMD64 2.086.0 and gdc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 > > on Ubuntu 19.04/64. > > Update: the hello world program works fine. Problem appears when > I add readf(" %s", &variable)
$ gdc-8 test.d -o shared $ nm shared | grep _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File U _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File $ objdump -T /usr/lib/x86_64-linux-gnu/libgphobos.so.76 | grep _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File 000000000034c610 w DF .text 0000000000000070 Base _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File $ gdc-8 test.d -o static -static-libphobos ibuclaw@labs-322:~ $ nm static | grep _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File 000000000002e720 W _D3std5stdio24__T10makeGlobalS6stdoutZ10makeGlobalFNbNcNdNiZS3std5stdio4File Can't reproduce, but then again one can't second guess what code you have. In all likelihood you're linking against the wrong library. -- Iain