is there a way to add a C include directory

About Monkey 2 Forums Monkey 2 Programming Help is there a way to add a C include directory

This topic contains 4 replies, has 2 voices, and was last updated by  codifies 2 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4964

    codifies
    Participant

    I would like to add an import directory so when importing a cpp file if it includes <subdirectory/file.h> I want to be able to add the directory containing this hiarchy

    somepath/includes/subdirectory/file.h

    g++ should get

    -Isomepath/includes/

    added to it (- capital i !!) when compiling the transpiled monkey2 file

    blugh too tired now, not explaining myself properly – time for bed!

    #4989

    Mark Sibly
    Keymaster

    Yes, use #Import “blah/*.h”.

    See ‘build system” in monkey2 language docs for more.

    See the SDL module for examples.

    #4990

    codifies
    Participant

    I tried that but it choked any time it hit the like of

    #include <foo/bar.h>

    for the time being I’ve symlinked all the includes into the root of the module as it happens to have the same name as the include directory… (the -I into the modules directory then allows the other includes to loaded by an include)

    #5034

    Mark Sibly
    Keymaster

    #include <foo/bar.h>

    Try:

    #Import “include/*.h”    ‘assuming ‘include’ dir contains ‘foo’ dir.
    #Import <foo/bar.h>

    This is used in several modules so it does work.

    #5039

    codifies
    Participant

    …well, I must have tried that 5 or 6 different ways! lol (horrible feeling I might have been trying to use a relative path)

    thanks Mark

    much appreciated.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.