Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Use additional C++ include directories #395

Open
Isko97 opened this issue Aug 10, 2018 · 4 comments
Open

Use additional C++ include directories #395

Isko97 opened this issue Aug 10, 2018 · 4 comments
Labels

Comments

@Isko97
Copy link

Isko97 commented Aug 10, 2018

I have a simple question, is it possible to use additional C++ include directories and to write include statements like
#include <mylib/file.hpp>

@paulocoutinhox
Copy link

Hi,

You want include line "#include <mylib/file.hpp>" into djinni generated header files?

Or you want add a prefix into djinni generated header files?

Ty.

@artwyman
Copy link
Contributor

Not sure what you mean by additional include directories precisely.

There are command-line arguments which can let you add a configurable prefix to includes of various types of files. For instance cpp-include-prefix defined here: https://github.com/dropbox/djinni/blob/master/src/source/Main.scala#L130

Djinni always writes includes in quotes like "foo.hpp" not angle-brackets like <foo.hpp> so if that's a distinction you were trying to make it's not something Djinni can do out of the box.

@Isko97
Copy link
Author

Isko97 commented Aug 11, 2018

I use gRPC as a transport protocol in my project which I want to implement in C++. Since the generated gRPC C++ source files are in a different directory than the C++ implementation of my app, I need to add the path to these files to the project to allow writing such include statements.
So in the implementation of my djinni generated C++ classes I need to access the gRPC source files and to write
#include <grpc/grpc.h>
Excuse me for not enunciating me correctly and I hope I could do it properly.

@paulocoutinhox
Copy link

You dont have problems about include it in your implementation. In your .cpp file (implementation file) include your files:

#include "MyDjinniClass.hpp"
#include <grpcpp/grpcpp.h>

void MyDjinniClass::method() {
    // example
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants