Hi all,
I’m having an issue where I’m trying to figure out how to properly include and make use of system headers that are project defined
At the bottom of my post, you can see the error messages. The interpreter seems to accept the delcaration of my custom object “testObj” however the moment i try using it, it fails.
I’m not sure if what I’m doing is not supported or wrong. Either way, could someone shed some light on this problem for me please?
Thanks
my mainfile
#include <iostream>
#include <string>
#include <cling/Interpreter/Interpreter.h>
static const std::string PATH_TO_STRUCTS = "/home/d4nf/clingTest/structs.C";
static const std::string PATH_TO_STRUCTS_SO = "/home/d4nf/clingTest/structs_C.so";
static const std::string PATH_TO_LLVM {"/home/d4nf/Downloads/Root-prefix/etc/cling"};
static const char * clingArgs[] = {"", "-std=c++11"};
int main()
{
cling::Interpreter inter(2, clingArgs, PATH_TO_LLVM.c_str());
inter.AddIncludePath("/home/d4nf/clingTest/sysinclude1/");
inter.DumpIncludePath();
inter.process("#include <someLib.h>\n"
"testObj foo;\n"
"foo.d = 66.0\n"
"std::cout << foo.d << std::endl;\n"
);
}
$ ls /home/d4nf/clingTest/sysinclude1/
someLib.h
someLib.h
[code]#ifndef someLib_H_CLING_TEST
#define someLib_H_CLING_TEST
#include
#include
#include
#include
struct testObj
{
testObj() {}
int a;
uint b;
double d;
std::string s;
//const char cs[50];
std::vector vecchar;
std::array<short,55> as;
};
#endif
[/code]
Runtime (tcling is the name of my exec)
./tcling
-I
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4
-I
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/x86_64-pc-linux-gnu
-I
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4/backward
-isystem
/usr/local/include
-isystem
/home/d4nf/Downloads/Root-prefix/etc/cling/lib/clang/3.7.0/include
-extern-c-isystem
/include
-extern-c-isystem
/usr/include
-I
/home/d4nf/Downloads/root-6.04.06/interpreter/cling/include
-I
/home/d4nf/Downloads/Root-build/interpreter/cling/include
-I
/home/d4nf/clingTest/sysinclude1/
-resource-dir
/home/d4nf/Downloads/Root-prefix/etc/cling/lib/clang/3.7.0
-nostdinc++
input_line_3:3:1: error: unknown type name 'foo'
foo.d = 66.0
^
input_line_3:3:4: error: cannot use dot operator on a type
foo.d = 66.0
^