Re: Error with -betterC

2024-11-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 09/11/2024 4:03 AM, Maximilian Naderer wrote: On Friday, 8 November 2024 at 11:21:33 UTC, Richard (Rikki) Andrew Cattermole wrote: On 09/11/2024 12:10 AM, Maximilian Naderer wrote: Is the -betterC config not creating the equals, hash functions which are generated by D ? I just checked, no.

Re: Error with -betterC

2024-11-08 Thread Maximilian Naderer via Digitalmars-d-learn
On Friday, 8 November 2024 at 11:21:33 UTC, Richard (Rikki) Andrew Cattermole wrote: On 09/11/2024 12:10 AM, Maximilian Naderer wrote: Is the -betterC config not creating the equals, hash functions which are generated by D ? I just checked, no. Hello Rikki, Thanks for checking. Just to conf

Re: Error with -betterC

2024-11-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 09/11/2024 12:10 AM, Maximilian Naderer wrote: Is the -betterC config not creating the equals, hash functions which are generated by D ? I just checked, no.

Re: Error when compiling with C libs

2024-10-15 Thread barbosso via Digitalmars-d-learn
On Sunday, 13 October 2024 at 21:28:41 UTC, Sergey wrote: On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote: error in line ```typedef float _Float32;``` clang can compile that line, but dmd or ldc can not! This is definatly compiler error! It is not an error.. This is just lack in the

Re: Error when compiling with C libs

2024-10-15 Thread barbosso via Digitalmars-d-learn
On Sunday, 13 October 2024 at 21:28:41 UTC, Sergey wrote: On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote: error in line ```typedef float _Float32;``` clang can compile that line, but dmd or ldc can not! This is definatly compiler error! It is not an error.. This is just lack in the

Re: Error when compiling with C libs

2024-10-13 Thread Sergey via Digitalmars-d-learn
On Sunday, 13 October 2024 at 20:06:44 UTC, barbosso wrote: error in line ```typedef float _Float32;``` clang can compile that line, but dmd or ldc can not! This is definatly compiler error! It is not an error.. This is just lack in the implementation. https://github.com/dlang/dmd/blob/f5fa64a

Re: Error when compiling with C libs

2024-10-13 Thread barbosso via Digitalmars-d-learn
On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote: I can compile tilengine examples with clang, but with ldc I get this error. Please explain the problem. ldc -betterC -gcc=clang -release -O3 -L-s -flto=full -Xcc=-I./Tilengine/include -L-L./Tilengine/build -L-l:libTilengine.a -L-lSDL

Re: Error when compiling with C libs

2024-10-13 Thread barbosso via Digitalmars-d-learn
On Sunday, 13 October 2024 at 14:55:51 UTC, Sergey wrote: On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote: I can compile tilengine examples with clang, but with ldc I get this error. Did you try this bindings? https://github.com/thechampagne/dtilengine I want betterC without bind

Re: Error when compiling with C libs

2024-10-13 Thread Sergey via Digitalmars-d-learn
On Sunday, 13 October 2024 at 13:49:49 UTC, barbosso wrote: I can compile tilengine examples with clang, but with ldc I get this error. Did you try this bindings? https://github.com/thechampagne/dtilengine

Re: Error: circular reference to variable cause by order (bugs?)

2024-07-18 Thread monkyyy via Digitalmars-d-learn
On Thursday, 18 July 2024 at 12:25:37 UTC, Dakota wrote: I am trying to translate some c code into d, get this error: ```d struct A { void* sub; } struct B { void* subs; } __gshared { const A[1] a0 = [ { &b1_ptr }, ]; const A[2] a1 = [

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-14 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 15/04/2024 10:36 AM, Liam McGillivray wrote: Well, it did work when I tried it (using a string variable, not a literal of course). It displayed as it is supposed to. But from the information I can find on the web it looks like strings are sometimes but not |always| zero-terminated. Not a gre

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sunday, 14 April 2024 at 22:36:18 UTC, Liam McGillivray wrote: On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer wrote: ```d void InitWindow(int width, int height, ref string title) { InitWindow(width, height, cast(const(char)*)title); } ``` This is invalid, a string may no

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-14 Thread Liam McGillivray via Digitalmars-d-learn
On Friday, 12 April 2024 at 15:24:38 UTC, Steven Schveighoffer wrote: ```d void InitWindow(int width, int height, ref string title) { InitWindow(width, height, cast(const(char)*)title); } ``` This is invalid, a string may not be zero-terminated. You can't just cast. Well, it did work whe

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 12 April 2024 at 00:04:48 UTC, Liam McGillivray wrote: Here's what I wanted to do. In the library I'm working on, there are various declarations for functions defined in an external C library following the line `extern (C) @nogc nothrow:`. Here are some examples of such declaration

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-11 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 9 April 2024 at 12:45:55 UTC, Richard (Rikki) Andrew Cattermole wrote: On 09/04/2024 12:48 PM, Liam McGillivray wrote: I suppose this was a good new thing to learn, though I'm still quite far from being able to construct a function from another function using a template. I suppo

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew Cattermole wrote: On 10/04/2024 11:21 AM, Liam McGillivray wrote: On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. So that func

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-10 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 10/04/2024 2:50 PM, Liam McGillivray wrote: On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew Cattermole wrote: The string mixin triggers CTFE, if ``EnumPrefixes`` wasn't templated, that would cause codegen and hence error. If you called it in a context that wasn't CTFE only,

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-09 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 9 April 2024 at 23:50:36 UTC, Richard (Rikki) Andrew Cattermole wrote: The string mixin triggers CTFE, if ``EnumPrefixes`` wasn't templated, that would cause codegen and hence error. If you called it in a context that wasn't CTFE only, it would codegen even with template and would e

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-09 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 10/04/2024 11:21 AM, Liam McGillivray wrote: On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. So that function is being used for both, and hence uses GC (appending). Are you sure that strin

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-09 Thread Liam McGillivray via Digitalmars-d-learn
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. So that function is being used for both, and hence uses GC (appending). Are you sure that string appending was really the problem that caused

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-09 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 09/04/2024 12:48 PM, Liam McGillivray wrote: On Tuesday, 9 April 2024 at 00:02:02 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d enum Value = (a, b) { return a + b; }(1, 2); ``` This alone should be a CTFE only function. But if we want template parameters, we'd need to wrap it wit

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-09 Thread Kagamin via Digitalmars-d-learn
On Sunday, 7 April 2024 at 06:46:39 UTC, Liam McGillivray wrote: instantiated from here: `front!char` Looks like autodecoding, try to comment `canFind`.

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-08 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 9 April 2024 at 00:02:02 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d enum Value = (a, b) { return a + b; }(1, 2); ``` This alone should be a CTFE only function. But if we want template parameters, we'd need to wrap it with the template. ```d template Value(int a, i

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 09/04/2024 11:42 AM, Liam McGillivray wrote: On Monday, 8 April 2024 at 08:12:22 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d template Foo(Args) { enum Foo = () {     return Args.init; }(); } ``` Something like that should work instead. I'm sorry, but I can't comprehend

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-08 Thread Liam McGillivray via Digitalmars-d-learn
On Monday, 8 April 2024 at 08:12:22 UTC, Richard (Rikki) Andrew Cattermole wrote: ```d template Foo(Args) { enum Foo = () {     return Args.init; }(); } ``` Something like that should work instead. I'm sorry, but I can't comprehend any of your example. What would be fed into `Args

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 08/04/2024 10:45 AM, Liam McGillivray wrote: On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. :-( Will this ever be changed? A tad unlikely, it would be a rather large change architectural

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-07 Thread Liam McGillivray via Digitalmars-d-learn
On Sunday, 7 April 2024 at 08:59:55 UTC, Richard (Rikki) Andrew Cattermole wrote: Unfortunately runtime and CTFE are the same target in the compiler. :-( Will this ever be changed? ```d template Foo(Args) { enum Foo = () { return Args.init; }(); } ``` Somethin

Re: "Error: `TypeInfo` cannot be used with -betterC" on a CTFE function

2024-04-07 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Unfortunately runtime and CTFE are the same target in the compiler. So that function is being used for both, and hence uses GC (appending). ```d template Foo(Args) { enum Foo = () { return Args.init; }(); } ``` Something like that should work instead.

Re: Error when using `import`.

2024-03-05 Thread Liam McGillivray via Digitalmars-d-learn
There's something that I'm trying to do that D may or may not be capable of. In the Map class, there is a 2-dimensional array called `grid`, where the Tile objects are stored. The Mission class inherits the Map class. In the Mission class, I want the `grid` array to instead be composed of a

Re: Error when using `import`.

2024-03-05 Thread Liam McGillivray via Digitalmars-d-learn
I have made some progress on this. For the raylib front-end, I tried making a class called `Mission` which inherits `Map`. This class handles the graphics, input, and other game events. The program now compiles without errors, and there are some graphics. I have pushed these updates to the GitH

Re: Error when using `import`.

2024-03-01 Thread monkyyy via Digitalmars-d-learn
On Friday, 1 March 2024 at 05:07:24 UTC, Liam McGillivray wrote: I don't know how best to organize the code. So far I have been oo ideas for a 2nd opinion: https://github.com/crazymonkyyy/raylib-2024/blob/master/docs/examplecode.md Theres not a good learning resource but "data oirented desig

Re: Error when using `import`.

2024-02-29 Thread Liam McGillivray via Digitalmars-d-learn
I now have the Raylib functions working by using `toStrinz`. I pushed some updates to the repository. I made the main project a source library so that I can experiment with different graphics library front-ends. I put have the front-end using Raylib in the `raylib_frontend` directory. It doesn

Re: Error when using `import`.

2024-02-28 Thread Danilo via Digitalmars-d-learn
Examples were moved, so it‘s in the same place now: - https://github.com/schveiguy/raylib-d - https://github.com/schveiguy/raylib-d_examples

Re: Error when using `import`.

2024-02-28 Thread Danilo via Digitalmars-d-learn
On Wednesday, 28 February 2024 at 07:56:16 UTC, Liam McGillivray wrote: ``` DrawText("Open Emblem", 180, 300, 64, Colors.RAYWHITE); ``` So why is it that one of these functions, but not the other is allowing D strings in place of C-style strings? C is expecting null-terminated chars. D strin

Re: Error when using `import`.

2024-02-28 Thread Liam McGillivray via Digitalmars-d-learn
There's something very strange going on when using Raylib-D. I tried using the raylib function `LoadTexture` like this: ``` tileSprites[i] = LoadTexture("../sprites/" ~ spriteName); ``` I got the following error: ``` Error: function `raylib.LoadTexture(const(char)* fileName)` is not callable us

Re: Error when using `import`.

2024-02-27 Thread Danilo via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 22:05:48 UTC, Liam McGillivray wrote: Looking at the code examples on the Raylib and SFML website, they look similar in complexity of getting started, but I like it that the Raylib website has lots of simple demonstration programs on the website with the code pro

Re: Error when using `import`.

2024-02-27 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 03:43:56 UTC, Liam McGillivray wrote: Raylib looks promising. I installed it along with your Raylib-d. I managed to build the example you provided with dub, but trying to use it in it's own dub project in a separate directory isn't working. Just copying and pasti

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
On Tuesday, 27 February 2024 at 03:06:19 UTC, Steven Schveighoffer wrote: If you are going for game development, I would recommend raylib-d (https://code.dlang.org/packages/raylib-d), which is my wrapper around the very good raylib library. For doing GUI, raygui is supported, but I also can sa

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 23:27:49 UTC, Liam McGillivray wrote: I don't know whether I should continue this topic or start a new one now that the problem mentioned in the title is fixed. I have now uploaded some of the code to [a GitHub repository](https://github.com/LiamM32/Open_Emblem).

Re: Error when using `import`.

2024-02-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 26 February 2024 at 22:40:49 UTC, Liam McGillivray wrote: On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote: You can't give a class the same name as the file it's in. If you do, then when you try to use it from another file, the compiler will get confused and think you'r

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
I don't know whether I should continue this topic or start a new one now that the problem mentioned in the title is fixed. I have now uploaded some of the code to [a GitHub repository](https://github.com/LiamM32/Open_Emblem). To make this game usable, I will need a library for graphics and in

Re: Error when using `import`.

2024-02-26 Thread Liam McGillivray via Digitalmars-d-learn
On Sunday, 25 February 2024 at 03:23:03 UTC, Paul Backus wrote: You can't give a class the same name as the file it's in. If you do, then when you try to use it from another file, the compiler will get confused and think you're referring to the file instead of the class (that's what "import is

Re: Error when using `import`.

2024-02-24 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 24 February 2024 at 10:31:06 UTC, Liam McGillivray wrote: `Unit.d` & `Map.d` are longer files. `Map.d` begins with `import Tile;`, and `Unit.d` begins with `import Map;`. Why are the errors happening? What's the problem? Why is it `currentclass.importedclass` instead of simply t

Re: Error when using `import`.

2024-02-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 24/02/2024 11:51 PM, Liam McGillivray wrote: On Saturday, 24 February 2024 at 10:34:25 UTC, Richard (Rikki) Andrew Cattermole wrote: A few things. Module names should be lower case. I capitalised the first letter in the class names so that I can make instances of them in lowercase. Shou

Re: Error when using `import`.

2024-02-24 Thread Liam McGillivray via Digitalmars-d-learn
On Saturday, 24 February 2024 at 10:34:25 UTC, Richard (Rikki) Andrew Cattermole wrote: A few things. Module names should be lower case. I capitalised the first letter in the class names so that I can make instances of them in lowercase. Should I rename the classes, modules, and filenames to

Re: Error when using `import`.

2024-02-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
A few things. Module names should be lower case. Each file, needs the full module declaration. source/foo/bar.d: ```d module foo.bar; ``` source/app.d: ```d module app; import foo.bar; ``` Directories matter, this allows the import path search (via the use of the -I switch) to loca

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-25 Thread Kagamin via Digitalmars-d-learn
Looks like the context is currently passed for nested functions, not for nested classes.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-21 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: Error: none of the overloads of template `once.main.each!((l)

2023-10-04 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 4 October 2023 at 08:11:12 UTC, Joel wrote: What am I missing? Splitter returns a forward range so you can't slice the result. You can use take() and drop() instead. Also, converting a string range to int[] doesn't seem to work, but I don't know if it should. Here is a version

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Vijay Nayar via Digitalmars-d-learn
On Thursday, 5 January 2023 at 16:41:32 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote: Does that class inherit the scope of the function it is inside, similar to how an inner class does with an outer class? yup. They can see the local variables from th

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote: Does that class inherit the scope of the function it is inside, similar to how an inner class does with an outer class? yup. They can see the local variables from the function.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Vijay Nayar via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and structs declared inside it have access to those local contexts, w

Re: Error

2022-10-31 Thread Johann via Digitalmars-d-learn
```d writeln (getSize(rom)) ``` reports 478 bytes but since you work with ushorts (why? as far as I can see, this is a 8 bit machine) you convert the read(rom) into ushorts, which is only half in size: ```d writeln (cast(ushort[])read(rom)); ``` gives you 478/2 = 239 bytes ```d this.memory[m

Re: Error "Unexpected '\n' when converting from type LockingTextReader to type int"

2022-09-07 Thread Ali Çehreli via Digitalmars-d-learn
On 9/7/22 16:24, Synopsis wrote: > a- What is the difference with this syntax with the exclamation mark? > ```readf!"%s\n"(f1.num);``` That's the templated version, which is safer because it checks at compile time (important distinction) that the arguments and the format specifiers do match.

Re: Error "Unexpected '\n' when converting from type LockingTextReader to type int"

2022-09-07 Thread rikki cattermole via Digitalmars-d-learn
On 08/09/2022 11:24 AM, Synopsis wrote: On Wednesday, 7 September 2022 at 23:06:44 UTC, rikki cattermole wrote: Text in buffer: "123\n" Read: "123" Text in buffer: "\n" Read: exception, expecting number for "\n" Changing your readf format specifier to include the new line should work. https:

Re: Error "Unexpected '\n' when converting from type LockingTextReader to type int"

2022-09-07 Thread Synopsis via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 23:06:44 UTC, rikki cattermole wrote: Text in buffer: "123\n" Read: "123" Text in buffer: "\n" Read: exception, expecting number for "\n" Changing your readf format specifier to include the new line should work. https://dlang.org/phobos/std_stdio.html#.File

Re: Error "Unexpected '\n' when converting from type LockingTextReader to type int"

2022-09-07 Thread rikki cattermole via Digitalmars-d-learn
Text in buffer: "123\n" Read: "123" Text in buffer: "\n" Read: exception, expecting number for "\n" Changing your readf format specifier to include the new line should work. https://dlang.org/phobos/std_stdio.html#.File.readf

Re: Error while generate DNA with uniform()

2022-09-03 Thread Ali Çehreli via Digitalmars-d-learn
On 9/3/22 14:18, Salih Dincer wrote: >uniform!"[]"(DNA.min, DNA.max); Even cleaner: uniform!DNA() :) Ali

Re: Error while generate DNA with uniform()

2022-09-03 Thread rassoc via Digitalmars-d-learn
On 9/3/22 23:18, Salih Dincer via Digitalmars-d-learn wrote: Clean-cut, thank you! It's very clear to me... Nothing major, but instead of `uniform!"[]"(DNA.min, DNA.max)`, you can simply use `uniform!DNA`. `uniform` considers the whole enum: https://github.com/dlang/phobos/blob/v2.100.1/std/

Re: Error while generate DNA with uniform()

2022-09-03 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 3 September 2022 at 21:09:09 UTC, Ali Çehreli wrote: Salih had asked: >> Can we solve this issue with our own `generate()` structure? Yes, I did the following to determine that adding Unqual was a solution: - Copy generate() functions to your source file, - Copy the Generator s

Re: Error while generate DNA with uniform()

2022-09-03 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 3 September 2022 at 14:25:48 UTC, Steven Schveighoffer wrote: [...] what you need anyway is a `char`, so just return a `char`. [...] Clean-cut, thank you! It's very clear to me... ```d import std; void main() { alias fp = char function() @system; enum DNA : char { ti

Re: Error while generate DNA with uniform()

2022-09-03 Thread Ali Çehreli via Digitalmars-d-learn
On 9/3/22 07:25, Steven Schveighoffer wrote: > There is probably a bug in generate when the element type is an `enum` > which somehow makes it const. Yes, Generator is missing an Unqual: https://issues.dlang.org/show_bug.cgi?id=23319 Salih had asked: >> Can we solve this issue with our own

Re: Error while generate DNA with uniform()

2022-09-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/3/22 8:09 AM, Salih Dincer wrote: Hi All, We discovered a bug yesterday and reported it: https://forum.dlang.org/thread/mailman.1386.1662137084.31357.digitalmars-d-b...@puremagic.com You know, there is `generate()` depend to `std.range`. It created the error when we use it with the va

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread Tejas via Digitalmars-d-learn
On Friday, 19 August 2022 at 16:36:24 UTC, MyNameHere wrote: On Friday, 19 August 2022 at 14:30:50 UTC, kinke wrote: Oh and `DevicePath()` is a convenience member returning a pointer to the 'dynamic array' (as the array decays to a pointer in C too), so no need to fiddle with `.offsetof` and c

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/19/22 12:36 PM, MyNameHere wrote: On Friday, 19 August 2022 at 14:30:50 UTC, kinke wrote: Oh and `DevicePath()` is a convenience member returning a pointer to the 'dynamic array' (as the array decays to a pointer in C too), so no need to fiddle with `.offsetof` and computing the pointer ma

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread MyNameHere via Digitalmars-d-learn
On Friday, 19 August 2022 at 14:30:50 UTC, kinke wrote: Oh and `DevicePath()` is a convenience member returning a pointer to the 'dynamic array' (as the array decays to a pointer in C too), so no need to fiddle with `.offsetof` and computing the pointer manually. I am using ```-BetterC```, so

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 August 2022 at 13:49:08 UTC, MyNameHere wrote: Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language. Oh and `DevicePath()` is a convenience member returning a pointer to

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
On Friday, 19 August 2022 at 14:22:04 UTC, Steven Schveighoffer wrote: On 8/19/22 9:49 AM, MyNameHere wrote: Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language. Most likely that "mem

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/19/22 9:49 AM, MyNameHere wrote: Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language. Most likely that "member" is a macro in C. D doesn't have macros, so it uses properties. T

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread MyNameHere via Digitalmars-d-learn
Thank you, that seems to have resolved the issue, though I wish these sorts of problems would stop cropping up, they are souring the experience with the language.

Re: "Error: no property `offsetof` for type `char*`"

2022-08-19 Thread kinke via Digitalmars-d-learn
It's a method returning a `CHAR*` - `_DevicePath` is the actual member. I guess it's a dynamically sized struct, which cannot be mapped directly to D, hence this representation.

Re: Error: cannot use non-constant CTFE pointer in an initializer `cast(immutable(char)*)TEST`

2022-06-11 Thread Tejas via Digitalmars-d-learn
On Saturday, 11 June 2022 at 11:51:43 UTC, Tejas wrote: On Saturday, 11 June 2022 at 10:07:46 UTC, test123 wrote: how to work this around. ```d __gshared const TEST = import(`onlineapp.d`); extern(C) void main(){ __gshared bin_ptr = TEST.ptr; } ``` ```sh dmd2 -betterC -J. onlineapp.d

Re: Error: cannot use non-constant CTFE pointer in an initializer `cast(immutable(char)*)TEST`

2022-06-11 Thread Tejas via Digitalmars-d-learn
On Saturday, 11 June 2022 at 10:07:46 UTC, test123 wrote: how to work this around. ```d __gshared const TEST = import(`onlineapp.d`); extern(C) void main(){ __gshared bin_ptr = TEST.ptr; } ``` ```sh dmd2 -betterC -J. onlineapp.d onlineapp.d(3): Error: cannot use non-constant CTFE point

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-26 Thread frame via Digitalmars-d-learn
On Thursday, 26 May 2022 at 16:56:49 UTC, Marcone wrote: On Friday, 20 May 2022 at 13:16:00 UTC, frame wrote: On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I tried compiling now on x64 without console using -L/SUBSYSTEM:windows user32.lib -L/entry:mainCRTStartup -m64 and it doesn'

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-26 Thread Marcone via Digitalmars-d-learn
On Friday, 20 May 2022 at 13:16:00 UTC, frame wrote: On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I am using a main() function. I am compiling on Windows x86 32 bits. I am using DMD 2.100.0 This error is only in version 2.100.0 of DMD. Did you try 2.099 too? Because the default bu

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-20 Thread Marcone via Digitalmars-d-learn
On Friday, 20 May 2022 at 13:16:00 UTC, frame wrote: On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I am using a main() function. I am compiling on Windows x86 32 bits. I am using DMD 2.100.0 This error is only in version 2.100.0 of DMD. Did you try 2.099 too? Because the default bu

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-20 Thread frame via Digitalmars-d-learn
On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I am using a main() function. I am compiling on Windows x86 32 bits. I am using DMD 2.100.0 This error is only in version 2.100.0 of DMD. Did you try 2.099 too? Because the default build mode for 32bit was changed to MS-COFF and it smel

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Marcone via Digitalmars-d-learn
On Thursday, 19 May 2022 at 22:13:06 UTC, Adam Ruppe wrote: On Thursday, 19 May 2022 at 21:41:50 UTC, Marcone wrote: Are you using the `-L/entry:mainCRTStartup` or the `L/entry:wmainCRTStartup` ? -L/entry:mainCRTStartup try the w one too. both doing the same result? Both is doing the same

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Adam Ruppe via Digitalmars-d-learn
On Thursday, 19 May 2022 at 21:41:50 UTC, Marcone wrote: Are you using the `-L/entry:mainCRTStartup` or the `L/entry:wmainCRTStartup` ? -L/entry:mainCRTStartup try the w one too. both doing the same result?

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Marcone via Digitalmars-d-learn
On Thursday, 19 May 2022 at 20:33:34 UTC, Adam D Ruppe wrote: On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I am using a main() function. I am compiling on Windows x86 32 bits. I am using DMD 2.100.0 This error is only in version 2.100.0 of DMD. Are you using the `-L/entry:mainCRTSt

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 19 May 2022 at 20:20:49 UTC, Marcone wrote: I am using a main() function. I am compiling on Windows x86 32 bits. I am using DMD 2.100.0 This error is only in version 2.100.0 of DMD. Are you using the `-L/entry:mainCRTStartup` or the `L/entry:wmainCRTStartup` ?

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Marcone via Digitalmars-d-learn
On Thursday, 19 May 2022 at 19:35:20 UTC, Adam D Ruppe wrote: On Thursday, 19 May 2022 at 19:29:25 UTC, Marcone wrote: Using -L/SUBSYSTEM:windows user32.lib you using a main() function right? Please note when compiling on Win64, you need to explicitly list -Lgdi32.lib -Luser32.lib on the bui

Re: Error: undefined symbol: _WinMain@16 When try compile no console

2022-05-19 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 19 May 2022 at 19:29:25 UTC, Marcone wrote: Using -L/SUBSYSTEM:windows user32.lib you using a main() function right? Please note when compiling on Win64, you need to explicitly list -Lgdi32.lib -Luser32.lib on the build command. If you want the Windows subsystem too, use -L/subs

Re: Error: variable `impl` cannot be modified at compile time

2022-05-13 Thread zoujiaqing via Digitalmars-d-learn
On Friday, 13 May 2022 at 19:48:04 UTC, Steven Schveighoffer wrote: On 5/13/22 3:46 PM, Steven Schveighoffer wrote: What writeln? Your compile trace is missing the original call line, and I would say probably more. Looking at your last commit, I figured it out: https://github.com/kerisy/arc

Re: Error: variable `impl` cannot be modified at compile time

2022-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/22 3:46 PM, Steven Schveighoffer wrote: What writeln? Your compile trace is missing the original call line, and I would say probably more. Looking at your last commit, I figured it out: https://github.com/kerisy/archttp/blob/545b3eb738261e92c88b4e4bb664b4fdfb206398/source/archttp/cod

Re: Error: variable `impl` cannot be modified at compile time

2022-05-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/13/22 3:39 PM, zoujiaqing wrote: ```bash % git clone https://github.com/kerisy/archttp.git % cd archttp/ % dub build --compiler=dmd Performing "debug" build using dmd for x86_64. archttp 0.0.1+commit.3.g70d44ef: building configuration "library"... ../../.dub/packages/nbuff-0.1.14/nbuff/sourc

Re: error connecting to mongodb atlas with vibe.d

2022-05-01 Thread Arjan via Digitalmars-d-learn
On Saturday, 30 April 2022 at 14:29:56 UTC, notsteve wrote: Hi, I am trying to setup a simple webserver in D using vibe.d (0.9.4) and want to use mongoDB as a database. To achieve this, I've set up a mongoDB atlas instance with the following command inside the standard app.d file created by v

Re: error connecting to mongodb atlas with vibe.d

2022-04-30 Thread Tejas via Digitalmars-d-learn
On Saturday, 30 April 2022 at 14:29:56 UTC, notsteve wrote: Hi, I am trying to setup a simple webserver in D using vibe.d (0.9.4) and want to use mongoDB as a database. To achieve this, I've set up a mongoDB atlas instance with the following command inside the standard app.d file created by v

Re: error forward references if scope

2022-03-12 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 12 March 2022 at 13:12:25 UTC, vit wrote: ```d enum touch_T = __traits(hasMember, T, "touch"); ``` I think you meant build instead of touch? ```d struct Query { public const SharedPtr!Builder builder; } interface Builder { void build(ref Query query); } struct SharedPtr(T) {

Re: error: rvalue constructor and a copy constructor

2022-01-12 Thread vit via Digitalmars-d-learn
On Wednesday, 12 January 2022 at 08:04:19 UTC, vit wrote: Hello, I have this code: ```d [...] run.dlang.io has old version of dmd-beta/dmd-nightly with bug

Re: Error: template instance does not match template declaration

2021-11-17 Thread Vitalii via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 18:00:59 UTC, Steven Schveighoffer wrote: On 11/17/21 7:55 AM, Vitalii wrote: [...] Template parameters are of 3 types: 1. A type parameter. This has a single symbol name, and represents a type *provided by the caller*. [...] Steve, thank you very much f

Re: Error: template instance does not match template declaration

2021-11-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/17/21 7:55 AM, Vitalii wrote: Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. Template parameters are of 3 types: 1. A type paramete

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 12:55:15 UTC, Vitalii wrote: Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. The following code compiles

Re: Error: template instance does not match template declaration

2021-11-17 Thread Vitalii via Digitalmars-d-learn
Thank you for response, Tejas! What I intended to do was make a class with only two states ("Inspect" - do some analysis, "Execute" - do some stuff). That's why I tried to use template specialization. The following code compiles successfully, but return *"fun with unknown"* instead of *"fun

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 12:19:05 UTC, Tejas wrote: On Wednesday, 17 November 2021 at 10:10:43 UTC, Vitalii wrote: Hello! I am getting the following error: ``` inst.d(8): Error: template instance `Worker!(Mode.Inspect)` does not match template declaration `Worker(mode : Mode) ``` whe

Re: Error: template instance does not match template declaration

2021-11-17 Thread Tejas via Digitalmars-d-learn
On Wednesday, 17 November 2021 at 10:10:43 UTC, Vitalii wrote: Hello! I am getting the following error: ``` inst.d(8): Error: template instance `Worker!(Mode.Inspect)` does not match template declaration `Worker(mode : Mode) ``` when compile next code: ``` enum Mode { Inspect, Execute } class

Re: Error: Could not open 'libcmt.lib'

2021-10-27 Thread bauss via Digitalmars-d-learn
On Monday, 25 October 2021 at 14:43:06 UTC, Willem wrote: Just starting out new with D. Up until now I have been using Python and a bit of OCaml. Error when linking: "lld-link: error: could not open 'libcmt.lib': no such file or directory" What I did: I installed the complete D setup in my

Re: Error: Could not open 'libcmt.lib'

2021-10-26 Thread Willem via Digitalmars-d-learn
On Monday, 25 October 2021 at 20:00:06 UTC, Dr Machine Code wrote: On Monday, 25 October 2021 at 15:43:06 UTC, Willem wrote: I was able to resolve above issues by following the install guide by DrIggy @ https://www.youtube.com/watch?v=fuJBj_tgsR8 Thanks for posting it. Willem A friend of mi

Re: Error: Could not open 'libcmt.lib'

2021-10-25 Thread Dr Machine Code via Digitalmars-d-learn
On Monday, 25 October 2021 at 15:43:06 UTC, Willem wrote: I was able to resolve above issues by following the install guide by DrIggy @ https://www.youtube.com/watch?v=fuJBj_tgsR8 Thanks for posting it. Willem A friend of mine was with this issue. We just end up using ldc2 but would be nice

  1   2   3   4   5   6   7   8   >