www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - I can not understand this Error: undefined identifier `cpp_longlong`

reply Dakota <dakota gmail.com> writes:
```sh
/ldc/import/core/stdc/stdint.d(96): Error: undefined identifier 
`cpp_longlong`
/ldc/import/core/stdc/stdint.d(97): Error: undefined identifier 
`cpp_ulonglong`
/ldc/import/core/stdc/stdint.d(118): Error: undefined identifier 
`cpp_ulong`
```

I am sure it defined because I add static assert to confirm this 
`config.d`:

```d
version (Windows)
{
     enum __c_long  : int;
     enum __c_ulong : uint;

     alias int   c_long;
     alias uint  c_ulong;

     alias __c_long   cpp_long;
     alias __c_ulong  cpp_ulong;

     alias long  cpp_longlong;
     alias ulong cpp_ulonglong;
}
else version (Posix)
{
   static if ( (void*).sizeof > int.sizeof )
   {
     enum __c_longlong  : long;
     enum __c_ulonglong : ulong;

     alias long  c_long;
     alias ulong c_ulong;

     alias long   cpp_long;
     alias ulong  cpp_ulong;

     alias __c_longlong  cpp_longlong;
     alias __c_ulonglong cpp_ulonglong;
   }
   else
   {
     enum __c_long  : int;
     enum __c_ulong : uint;

     alias int   c_long;
     alias uint  c_ulong;

     alias __c_long   cpp_long;
     alias __c_ulong  cpp_ulong;

     alias long  cpp_longlong;
     alias ulong cpp_ulonglong;
   }
   static assert(false);
}
```

If I run a simple test file, it will work.


But in big project there is a lot import circular reference, and 
some args or file order. I get it.


LDC 1.40.0-beta4 for macOS.


I also test on linux ldc 1.40.0-beta4, the error changed:


```sh
/ldc/import/core/sys/posix/sys/types.d(109): Error: undefined 
identifier `c_long`
```
Nov 19 2024
parent Dakota <dakota gmail.com> writes:
On Wednesday, 20 November 2024 at 07:02:25 UTC, Dakota wrote:
 I am sure it defined because I add static assert to confirm 
 this `config.d`:
and not sure how to work this around: ```sh llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/ldc/bin/ldc2+0x1038098f7) (/ldc/bin/ldc2+0x103807976) (/ldc/bin/ldc2+0x10380a0c0) (/usr/lib/system/libsystem_platform.dylib+0x7ff8004265ed) ToConstElemVisitor::visit(StructLiteralExp*) (/ldc/bin/ldc2+0x103c45c22) Expression*) (/ldc/bin/ldc2+0x103c03221) (/ldc/bin/ldc2+0x103c7b23e) (/ldc/bin/ldc2+0x103be4575) (/ldc/bin/ldc2+0x103be403d) (/ldc/bin/ldc2+0x103be403d) (/ldc/bin/ldc2+0x103be403d) (/ldc/bin/ldc2+0x103be4e7d) (/ldc/bin/ldc2+0x103be403d) (/ldc/bin/ldc2+0x103c0b786) (/ldc/bin/ldc2+0x103c909ba) (/ldc/bin/ldc2+0x103caa554) (/ldc/bin/ldc2+0x103ba09c1) Error: Error executing /ldc/bin/ldc2: Segmentation fault: 11 ``` linux: ```sh llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/ldc/bin/ldc2+0x6dc5757) (/ldc/bin/ldc2+0x6dc354c) ld-temp.o:0:0 ToConstElemVisitor::visit(StructLiteralExp*) ld-temp.o:0:0 Expression*) (/ldc/bin/ldc2+0x7078166) (/ldc/bin/ldc2+0x710723f) ld-temp.o:0:0 ld-temp.o:0:0 ld-temp.o:0:0 ld-temp.o:0:0 ld-temp.o:0:0 ld-temp.o:0:0 (/ldc/bin/ldc2+0x708be12) (/ldc/bin/ldc2+0x7128415) (/ldc/bin/ldc2+0x3b692a8) (/ldc/bin/ldc2+0x3b12231) _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv (/ldc/bin/ldc2+0x72e21bd) ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3 ./csu/../csu/libc-start.c:347:5 Error: Error executing /ldc/bin/ldc2: Segmentation fault ```
Nov 20 2024