How to add headers from Gem?

0

I am writing a simple C++ program to interface with Twitch, however there is no good way of adding in the Chatplay header file without having relative paths. I was wondering if there was something I am missing for adding in Gem headers files to code outside of the gem WITHOUT using relative paths.

For example, I have an include:

#include <../../../Gems/ChatPlay/Code/Include/ChatPlay/ChatPlayBus.h>

But would rather have something like:

#include <Gem/Chatplay/Code/Include/ChatPlay/ChatPlayBus.h>

asked 6 years ago182 views
3 Answers
0
Accepted Answer

You could alter the waf file to include the Gems folder if not already done, just open the wscript and alter the bld.<ProjectName> call and add the gem folder to the includes item.

def build(bld):

bld.<ProjectName>(

...

includes = [...,

bld.Path('Gems'),

...],

...

)

then you could just use

#include <Chatplay/Code/Include/ChatPlay/ChatPlayBus.h>

or you could be less generic and include that gem only in the includes

bld.Path('Gems/Chatplay/Code/Include'),

...

#include <ChatPlay/ChatPlayBus.h>

answered 6 years ago
0

I added in the gem into the 'use' folder which does the 'pathing' for you.

ie. use = ['ChatPlay']

Thanks for your suggestion!

answered 6 years ago
0

Provided you have already enabled the Gem in your project, you can just do "#include <GemName/GemNameBus.h>" as stated in the Gem Docs.

In your case it would probably be "#include <ChatPlay/ChatPlayBus.h>"

Accessing Gems in Code

You can access gems through code, as in the following example:

<code>>#include <GemName/GemNameBus.h>
//...
EBUS_EVENT(GemName::GemNameRequestBus, MyFunction, withArgs);
answered 6 years ago

This post is closed: Adding new answers, comments, and votes is disabled.