Accessing a function from another .C file

Hello.
I am trying to access a function from defined in one *.C function and implement it in another *.C file. The code goes:

//file1.C
#include "file1.h"
#include "file2.h"

int someFunction() {
 int function0 ();
 function0 = functionFromFile2 ();
 //other tasks here
}
//file1.h
#ifndef FILE1
#define FILE1

int someFunction();
#endif
//file2.C
#include "file2.h"

int functionFromFile2() {
 //.................
}
//file2.h
#ifndef FILE2
#define FILE2

int functionFromFile2();

#endif

I load the function

> .L file1.C
> someFunction()

gives the complain

functionFromFile2() declared but not defined .....

Aren’t the necessary ‘includes’ in place?

It works OK if I load the *.C files as

> .L file1.C
> .L file2.C
> someFunction()

Hi,

try to think about the message you were given:

So yes, the correct includes were in place to pull in the declaration of that function. The definition is in the *.C file which isn’t included. Loading it makes the definition visible.

Would it not make it tedious to load Godzillion *.C files for a more complicated program? :unamused:

You can always create a single *.C file which includes every other *.C file you care about. Alternatively creating a shared library is a proper solution and expecting CINT to magically know declarations of your functions is asking a little too much from it.

Ok, thank you. I think thats a better way to respond rather than responding rudely.

Oh sorry, I didn’t want to be offensive but rather reassure you in making better use of the already surprisingly useful diagnostic message from CINT.