dpp icon indicating copy to clipboard operation
dpp copied to clipboard

unknown type name 'uint32_t'

Open trikko opened this issue 2 years ago • 3 comments

t.h:

#include <stdint.h>
uint32_t test;

t.dpp:

#include "t.h"

void main()
{
}

> d++ t.dpp

output:

Error: Error parsing '/tmp/libclangYrt380':
./t.h:3:1: error: unknown type name 'uint32_t'
Program exited with code 1

linux + libclang10 + dpp 0.4.9

Including inttypes.h makes things even worse.

trikko avatar Mar 04 '22 11:03 trikko

I can't reproduce this. The error message indicates that libclang can't parse the code you wrote, which is more than odd.

atilaneves avatar Mar 07 '22 17:03 atilaneves

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).

lulcat avatar Apr 12 '22 18:04 lulcat

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

tom-tan avatar Jul 11 '22 15:07 tom-tan

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.

klknn avatar Sep 26 '22 17:09 klknn