Fraunhofer-IIS / libjapi

libjapi is a universal JSON to C API library. It receives newline-delimited JSON (NDJSON) messages via TCP and calls registered C functions. A JSON response is returned for each request. Furthermore, it is also possible to create push services, which asynchronously push JSON messages to the clients subscribed to them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include errors using <>/""

fraunhofer-iis-bot opened this issue · comments

In GitLab by @bmi on Mar 29, 2023, 11:39

Include files with "" or <> are not trivial

for local files use always ""
for not local files(like librarys) use <>

Problem occurs when if the include path not set as expected by user of the library
using the correct include pattern solves the problem

In GitLab by @vornkat-iis on Jun 30, 2023, 14:40

@bmi can you give a concrete example for that? The example in the docs uses <> because it assumes the library is installed as package (as available here). I will add a comment there, see 87b99c8

In GitLab by @bmi on Jun 30, 2023, 15:14

The example is: You dont know how a user with the source code will use the library. You expect that he is using the code as a single library, installed in Linux first before he is starting to develope his code. But this is not every time the case(this is not my normal behavoure of using a libray i get to work with). if you only provide the library than is this ok, but you want to provide the source code.

It is a bad coding style only to provide one way to use the source code. And especially from such a trivial thing as the include.

What is the problem: The linker will not find the include with <> if it is not in the in the same way your statemant is given. if you use "" the linker will look lokal from the source path to the given satement without a correct $path configured is needed.

Read mode about:
https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html

In GitLab by @vornkat-iis on Jul 2, 2023, 18:08

I understand but when looking through the code, I did not find any error on that. Only the example given in the docs which uses libJAPI from the package instead from a submodule.

Can you describe the situation in which you had problems? Do you maybe know where there are wrong imports in the code?

In GitLab by @bmi on Jul 3, 2023, 08:31

japi.h line 21

but i not checked every code
the docs are not the problem examples are ok with using include <>

In GitLab by @vornkat-iis on Jul 3, 2023, 09:49

created branch 46-include-errors-using to address this issue