ACliC compilation problems

Hi, I’m using ROOT V5.12, and I try to compile the code joined below (solver.c) with ACliC , but I always get the same error

[quote]root [30] .x solver.c+
Info in : creating shared library /home/gcm/mbenoit/Champs_analytique/./solver_c.so
/home/gcm/mbenoit/Champs_analytique/fileFhOz4b.cxx: In function int G__fileFhOz4b__8_171(G__value*, const char*, G__param*, int)': /home/gcm/mbenoit/Champs_analytique/fileFhOz4b.cxx:70:class TMatrixD’ used
where a long int' was expected /home/gcm/mbenoit/Champs_analytique/fileFhOz4b.cxx: In functionint
G__fileFhOz4b__9_171(G__value*, const char*, G__param*, int)’:
/home/gcm/mbenoit/Champs_analytique/fileFhOz4b.cxx:77: class TMatrixD' used where along int’ was expected
g++: /home/gcm/mbenoit/Champs_analytique/./fileFhOz4b.o: No such file or directory
Error in : Compilation failed!
Error: Function solver() is not defined in current scope :0:
*** Interpreter error recovered ***
root [31] [/quote]

I have absolutely no idea of what this can mean !!! :confused:

I tried to compile it with g++ , using the next joined file (solvercompile.c). It works just fine , but I have no graphics, even if I add a TApplication at the beginning of the main() function.
I used the command in makefile to compile.

PS:You might need to change the path in the headers to try the files locally.

Thank you !
Mathieu B
makefile.txt (311 Bytes)
solvercompile.c (5.61 KB)
solver.c (5.61 KB)

Hi,

This is a problem (that we will fix) with the autload (which is used by rootcint (which is used by ACliC)) which leads to the mis-interpretation of the return type (when it’s a TMatrixD).

TMatrixD initx(double pix, double gap,int precision){
To work around this problem you can either hide those function from rootcint:

#ifndef __MAKECINT__ TMatrixD initx(double pix, double gap,int precision){....} #endif
or change the return type (which would be a good idea since your currently very un-efficiently copies the TMatrixD at least twice (uselessly).

Cheers,
Philippe

Since I posted this I completely rewrote the thing completely avoiding returning anything.

Me and computer code efficiency makes two. But I swear , Yes I swear :open_mouth: , that I will learn the good way.

I’m completely on my own for that. My only teachers are me and you people here, soo keep up the good job !

(You can always take a look a the new code and tell me if it is better, as you wish :wink:)

Thank you again !

Mathieu B
solvercompile.c (5.62 KB)

Instead ofvoid boucle(double pix,double gap,double Voltage, int precision, TH2D* Vprec,TMatrixD X, TMatrixD Y)to

I strongly recommend that you read the following 2 booksl

Andrew Koenig and Barbara E. Moo:
Accelerated C++: Practical Programming by Example.
Addison-Wesley, 2000.
ISBN 0-201-70353-X.
acceleratedcpp.com

Herb Sutter and Andrei Alexandrescu:
C++ Coding Standards: 101 Rules, Guidelines, and Best Practices.
Addison-Wesley, 2005.
ISBN 0-321-11358-6.
gotw.ca/publications/c++cs.htm

Cheers,
Philippe

THank you so very much !

Mathieu