"need `this` for `s` of type `char*`" error message

rempas rempas at tutanota.com
Thu Nov 11 07:04:57 UTC 2021


After not being able to use ImportC to automatically compile a C 
library, now I'm trying to do it myself. The library I want to 
use is [tomlc99](https://github.com/cktan/tomlc99) which is a 
small C library to parse toml files. Now I compiled the library 
and I copied the "config.h" file and modified to make it a D file 
that will contain the declaration so D knows which symbols to 
call. I resulted with a "toml.d" file and a "main.d" file. The 
first one contains the decorations and the second one contains 
the code from the example in the 
[usage](https://github.com/cktan/tomlc99#usage) section. However, 
when I try to compile, I'm getting the following error message:

```
main.d(51): Error: need `this` for `s` of type `char*`
Deprecation: argument `__error` for format specification `"%s"` 
must be `char*`, not `_error_`
main.d(57): Error: need `this` for `i` of type `long`
main.d(63): Error: need `this` for `s` of type `char*`
```

I uploaded the modified files so someone is able to look at them 
and explain me what I'm doing wrong so I can properly learn. 
Links:

[toml.d](https://gist.github.com/rempas/8aaab43b71e3da720ce298ef472f0673)
[main.d](https://gist.github.com/rempas/07dfb15295c5f6142c6a8dfab669c40e)


More information about the Digitalmars-d-learn mailing list