Libc functions undefined when linking

Ben Jones fake at fake.fake
Tue Jan 4 18:45:37 UTC 2022


On Tuesday, 4 January 2022 at 18:37:25 UTC, Adam D Ruppe wrote:
> On Tuesday, 4 January 2022 at 18:13:56 UTC, Ben Jones wrote:
>> clang -c -o source/assignment1.o source/assignment1.c
>
> you might have better luck just telling clang to link it too
>
> like
>
> clang source/assignment1.o -lphobos2 build/*.o # etc
>
> since there's a bunch of default search paths and libs etc the 
> compiler pass to the linker.
>
> otherwise if you do need to use the linker directly worth 
> remembering the order of args matter too. you need to put the 
> more derived dependencies first followed by more general ones 
> at the end

Using clang seems to work better.  It sounds like Apple basically 
hides system libraries since Big Sur, and I guess their clang 
knows the magic flags to pass to find them.

Thanks!


More information about the Digitalmars-d-learn mailing list