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 !!!
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.
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).
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