Closed trikko closed 2 years ago
I can't reproduce this. The error message indicates that libclang can't parse the code you wrote, which is more than odd.
I'll add this worked fine for me, I compiled with clan 12.0.0 (and llvm), and latest dmd/ldc (2.99.1/1.29.0 or so).
I have a similar issue with the following instructions:
$ ls
issue307.dpp
$ cat issue307.dpp
#include <stdint.h>
uint32_t test;
void main(){}
$ docker run --rm -it -v $PWD:/workdir -w /workdir ubuntu:22.04 bash
# apt update
# apt install -y build-essential curl clang libclang1 libclang-dev
# ln -s /usr/lib/x86_64-linux-gnu/libclang-14.so.1 /usr/lib/x86_64-linux-gnu/libclang.so
# curl -fsS https://dlang.org/install.sh | bash -s dmd
# source ~/dlang/dmd-2.100.0/activate
# dub fetch dpp
# dub run dpp -- issue307.dpp
...
Running ../root/.dub/packages/dpp-0.4.10/dpp/bin/d++ issue307.dpp
Error: Could not execute `dmd ./issue307.d -of=issue307`:
./issue307.d(102): Error: undefined identifier `uint32_t`
Program exited with code 1
I had the similar issue when I linked clang-14
to /usr/bin/clang
in ubuntu 22.04. When I changed it to clang-12, everything worked fine.
t.h:
t.dpp:
> d++ t.dpp
output:
linux + libclang10 + dpp 0.4.9
Including inttypes.h makes things even worse.