touchReadXY is defined both in arm7 and arm9. Maybe you missed some steps in the head part of your code:

[pascal]
program main9;
{$apptype arm9}
{$define ARM9}

{$mode objfpc}

uses
ctypes;

{$include nds.inc}

begin
// Your code for ARM9 here
end.
[/pascal]


[pascal]
program main7;
{$apptype arm7}
{$define ARM7}

{$mode objfpc}

uses
ctypes;

{$include nds.inc}

begin
// Your code for ARM7 here
end.
[/pascal]

Without these defines, the compiler can't compile your code correctly, nor libnds will be linked in the right way.