How to add headers from Gem?

,

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>

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

def build(bld):

bld.(

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>

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

ie. use = [‘ChatPlay’]

Thanks for your suggestion!

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);