Root6 linking problems

I just installed Root6. I get linking problems when I try to call another macro from my main program. Here is a minimal example that reproduces the error. There is three files: macro.cc, test.hh, and test.cc

macro.cpp
#include "test.hh"
void macro(){
test *mytest=new test();
}

test.hh
class test{
public:
test();
};

test.cc
include
#include "test.hh"
using namespace std;
test::test(){
cout<<“print something”<<endl;
}

I compile macro.cc with the command .x macro.cc+
Then I get this error:
/home/helga/InstallRoot/installDir/bin/root.exe: symbol lookup error: /home/helga//GuiTests/testing/macro_cc.so: undefined symbol: _ZN4testC1Ev

echo $LD_LIBRARY_PATH gives:
/home/helga/InstallRoot/installDir/:/home/helga/InstallRoot/installDir/lib:/home/helga/InstallRoot/installDir/

echo $PATH gives:
/home/helga/InstallRoot/installDir/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/helga/.local/bin:/home/helga/bin

Try first “.L test.cc++” and then “.x macro.cc++”

Thanks for the fast answer. I did as you said and I still have the same problem. I had to change the function macro() function to returning an int instead of being void, I don’t know why…

What is the right way of including a macro into another one now with Root6. Do I do it the wrong way? (most probable since it does not work…)

“test.hh”: #if !defined(__TEST_HH__) #define __TEST_HH__ class test { public: test(); }; #endif /* !defined(__TEST_HH__) */

Thanks a lot, it looked like header guards was the problem:)
How can I do the compiling of the test macro in the macro.cc script?

Try to #includetest.cc” instead of #include “test.hh” in the macro.cc script.