.h file and .cxx file?

Hi, my teacher has given me two files, one .h and the other one .cxx.

In the first one he creates a library and declares the methods that he will use.

In the .cxx one he wrote what the methods, constructors do.

How can I run them from cmd?

First write .L namefile.h and then .x namefile.cxx ? I obtain errors with this method

I use root 6 on Windows 10 with visual studio 2019

.x namefile.cxx

Should be enough. What errors do you get ?

I have tried and I have this error:

IncrementalExecutor::executeFunction: symbol '?GenerateInitInstance@ROOT@@YAPAVTGenericClassInfo@1@PBVMyClass@@@Z' unresolved while linking function '??__Eid@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A@YAXXZcling_module_9_'!
You are probably missing the definition of class ROOT::TGenericClassInfo * __cdecl ROOT::GenerateInitInstance(class MyClass const *)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '?Class@MyClass@@SAPAVTClass@@XZ' unresolved while linking function '??__Eid@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A@YAXXZcling_module_9_'!
You are probably missing the definition of public: static class TClass * __cdecl MyClass::Class(void)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '?Streamer@MyClass@@UAEXAAVTBuffer@@@Z' unresolved while linking function '??__Eid@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A@YAXXZcling_module_9_'!
You are probably missing the definition of public: virtual void __thiscall MyClass::Streamer(class TBuffer &)
Maybe you need to load the corresponding shared library?

Why don’t you ask your “teacher” how you’re supposed to use his/her files?

1 Like

Because I don’t see him till friday, if you want to help me good otherwise bye bye

It is really difficult to help you. We even do not have your code …

I’m only trying to create a class in which I define .h file with declaration of methods and a .cxx file (or a .cpp file?) for implementation.

This is the header file (an example)

MyClass.h (959 Bytes)

and then a .cxx file for implementation but when I write on it :

#include "MyClass.h" 

and try to run it the cmd says me:

IncrementalExecutor::executeFunction: symbol '??0MyClass@@QAE@XZ' unresolved while linking [cling interface function]!
You are probably missing the definition of public: __thiscall MyClass::MyClass(void)
Maybe you need to load the corresponding shared library?

but the same thing doesn’t happen if I write in cmd: #include “MyClass.h”

You can try:
.L MyClass.cxx
and / or:
.L MyClass.cxx++

@Wile_E_Coyote Thank you for the answer.

No errors with .L MyClass.cxx, why? why does in my case .x MyClass.cxx give error?

Moreover, where have I to put the .h file? I have put it everywhere (in the macros folder, in the folder include of visual studio and root)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.