On 4/15/20 8:38 AM, Robert M. Münch wrote:
On 2020-04-14 18:44:55 +0000, Steven Schveighoffer said:
On 4/14/20 2:29 PM, Robert M. Münch wrote:
No. Is that the missing part?
Probably. I think the compiler expects whatever is compiling the
imported file to provide the symbol. If you aren't compiling it
separately, then you need to include it in the compilation.
The C lib contains the smybols and I thought that the compiler just
needs the imports to get an idea about the structures, types, etc. and
later on the links resolves everything.
But, it works when I explicitly add the import source files to the
VisualD project. Not sure what difference this makes, because the source
can be compiled without any problems with/without those files added. But
it seems that the linker now sees different things.
The difference is you are telling the compiler that you it should
generate any symbols for those types. If you just import them, then it's
expecting something else to build those symbols.
You could also build a library that builds those symbols, and link in
that library instead.
What's strange is, that for a dub project that uses the same imports, I
didn't had to add them to the dub.json file. There, it just works
without any problems.
dub builds all dependencies so this is like the library solution.
-Steve