Importing C++

BlitzMax Forums/BlitzMax Programming/Importing C++

BLaBZ(Posted 2014) [#1]
Hi all,

I'm attempting to import some c++ functionality and the sdk in which I'm trying to import references all of the headers using carrot brackets <>, If I change them to "" it works! There's just a lot I have to change and it's very tedious.

Is there a better way to go about this? Is this sometimes necessary when importing c++ libraries?

Thanks!


Henri(Posted 2014) [#2]
Hello,

<> searches header files from all the defined places and "" from current directory only. Usually header file locations are defined in IDE like codeblocks or Visual studio. With MinGW command line you can specify additional folders like Blitzmax does internally. In module files there are commandline switches for this purpose. You should not change to quotes, but find where to define those folders. Otherwise it's a endless task.

-Henri


Yasha(Posted 2014) [#3]
As Henri said... this is never supposed to be necessary when using C++. It means your SDK was designed with a more advanced build process in mind than however you've ended up importing it - some stage in the make process will add the -I"location/of/headers" option to the GCC invocation so that GCC knows where to search for angle-bracketed includes. This is usually a variable like CC_OPTS or something.

1. I don't think there's any way to do this dynamically with BlitzMax - you have to rebuild bmk and bake such additions into the compiler

2. the fact that this step is missing from the build process is a warning that other things may also be missing if you try to do it all by hand

Basically you would be best advised to try to build the C++ code separately into a shared or static library of some kind using the project's own build system, then import that binary file into BlitzMax, not the uncompiled C++ which BlitzMax really isn't designed to handle properly.