Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 20, 2016 DUB and pragma lib - OSX | ||||
---|---|---|---|---|
| ||||
How do I get this C stuff working with DUB? I tried putting the pragmas in the main source file. extern(C) char* readline(const(char)* prompt); extern(C) void add_history(const(char)* prompt); pragma(lib, "readline"); pragma(lib, "curses"); Linking... Undefined symbols for architecture x86_64: "_add_history", referenced from: _D5mmisc7getLineFAyaZAya in bookkeeping.o "_readline", referenced from: _D5mmisc7getLineFAyaZAya in bookkeeping.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) --- errorlevel 1 dmd failed with exit code 1. Joels-MacBook-Pro:BookKeeping joelcnz$ The C stuff works without DUB. |
April 20, 2016 Re: DUB and pragma lib - OSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joel | On Wednesday, 20 April 2016 at 05:53:28 UTC, Joel wrote:
> How do I get this C stuff working with DUB?
Mind posting your dub configuration file?
|
April 20, 2016 Re: DUB and pragma lib - OSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joel | On 20/04/2016 5:53 PM, Joel wrote:
> How do I get this C stuff working with DUB? I tried putting the pragmas
> in the main source file.
>
> extern(C) char* readline(const(char)* prompt);
> extern(C) void add_history(const(char)* prompt);
>
> pragma(lib, "readline");
> pragma(lib, "curses");
>
> Linking...
> Undefined symbols for architecture x86_64:
> "_add_history", referenced from:
> _D5mmisc7getLineFAyaZAya in bookkeeping.o
> "_readline", referenced from:
> _D5mmisc7getLineFAyaZAya in bookkeeping.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> --- errorlevel 1
> dmd failed with exit code 1.
> Joels-MacBook-Pro:BookKeeping joelcnz$
>
> The C stuff works without DUB.
Dub does separate compilation and linking.
Add them as "libs": ["readline", "curses"] for dub.json (sdl is a bit similar).
|
April 20, 2016 Re: DUB and pragma lib - OSX | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Wednesday, 20 April 2016 at 06:16:35 UTC, rikki cattermole wrote:
> On 20/04/2016 5:53 PM, Joel wrote:
>> [...]
>
> Dub does separate compilation and linking.
> Add them as "libs": ["readline", "curses"] for dub.json (sdl is a bit similar).
Yay! Worked, thanks rikki cattermole!
|
Copyright © 1999-2021 by the D Language Foundation