Help required in CINT with Qt in Ubuntu

HI

I have installed CINT and configure system path and path variables as described in read me file.

I am trying to export a C++ class and call the class member function from a script file.
I have passed this script file to CINT.

Created qt .h file
G3.h

class hello
{
public:
hello();
void fun1();
};

created qt .cpp file
G3.cpp

#include “G3.h”
#include <iostream.h>
using namespace std;

hello::hello()
{
}
void hello::fun1()
{
cout<< “Hello world”;
}

After this using cint i created .cxx file using below command

cint -w0 -nG__G3Test.cxx G3.h

this .cxx file contains definations for Hello class.

Now i included this .cxx file as dll and created small window application where i can pass script file.

script.cpp
#include “G3.h”

int main()
{
hello h1;
h1.fun1();
return 0;
}

This script file i am passing from window application as below

G__scratch_all();
G__init_cint(“home/workingDir/script.cpp”);
G__scratch_all();

I am getting the following issue.

Error: hello() declared but not defined in current scope FILE:/home/workingDir/script.cpp LINE:4
!!! return from main() function

I am trying in Ubuntu 14.04. With out cint my application able to execute the exported function.

Can you please help me where i did wrong or if the procedure is wrong please provide me any links or docs.

Thank you
Sreeni

Hi Sreeni,

I’m looking for the information that you need; we’ll update here as soon as it’s available.

David

Hi,

It might take a few days (maybe even next week) to get more information for you; we’ll add more as soon as possible.

Yours,
David

Hi,

It’s likely the sequence of loading the DLL vs scratch_all(): the DLL provides information for CINT that you then reset.

Can you call scratch_all() and then load the library?

Cheers, Axel.

Hi Axel,

Thank you,

I loaded G3.so after scratch_all() as below.

G_register_sharedlib(“G3.so”)

Still it did not work :frowning:

Hi,

G_register_sharedlib() doesn’t actually load the library, it only re-registers an already loaded one. Could you try with G__shl_load(“G3.so”)?

Cheers, Axel.

Hi All,

Thank you all for your replies.

Problems solved with following fixes:

  1. Added below MACROS while exporting .cxx file to cint library.
    G__REDIRECTIO
    G__NEWSTDHEADER
    _CRT_SECURE_NO_DEPRECATE=1
    CC_WSDK61
    MKINC_CWD
    G__IOSE_CWD
    G__HAVE_CONFIG
    G__NOMAKEINFO
    G__CINTBODY
    REFLEX_CINT_MERGE
    Internal=I
    _MBCS
    STRUCT_ALIGNMENT_1BYTE
    SUPPORT_NEW_PMU=1
    FIPS_ENABLE=1

  2. Provide extra below call with cpp environment function pointer.

     G__set_p2setup(G__set_cpp_environment);
     G__init_cint("script.cxx");