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>

질문됨 6년 전195회 조회
3개 답변
0
수락된 답변

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>

답변함 6년 전
0

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

ie. use = ['ChatPlay']

Thanks for your suggestion!

답변함 6년 전
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);
답변함 6년 전

이 게시물은 마감됨: 새 답변, 댓글 및 투표 추가가 비활성화되었습니다.

관련 콘텐츠