This is the syntax i use.
It is as if Cint did not recognized my vector.
I have many mistakes which disapear when i delete "vector < test> v;
This is the error message
[code]
Note: Link requested for already precompiled class vector<double,allocator > (ignore this message) :0:
In file included from /home/homelocal/GeomRoo/AutoDict_vector_test_.cxx:2,
from /home/homelocal/GeomRoo/AutoDict_vector_test__cxx_ACLiC_dict.h:34,
from /home/homelocal/GeomRoo/AutoDict_vector_test__cxx_ACLiC_dict.cxx:17:
/home/homelocal/GeomRoo/./AssemblageThomas.C:28:18: warning: extra tokens at end of #include directive
In file included from /home/homelocal/GeomRoo/AutoDict_vector_test_.cxx:2,
from /home/homelocal/GeomRoo/AutoDict_vector_test__cxx_ACLiC_dict.h:34,
from /home/homelocal/GeomRoo/AutoDict_vector_test__cxx_ACLiC_dict.cxx:17:
/home/homelocal/GeomRoo/./AssemblageThomas.C:40: warning: ‘typedef’ was ignored in this declaration
/home/homelocal/GeomRoo/./AssemblageThomas.C:43: error: expected constructor, destructor, or type conversion before ‘->’ token
Error in : Compilation failed!
In file included from /home/homelocal/GeomRoo/AutoDict_random_access_iterator_test_long_.cxx:2,
from /tmp/rootcint_V45J9B.h:3,
from /tmp/BZehJI_cint.cxx:1:
/home/homelocal/GeomRoo/./AssemblageThomas.C:28:18: warning: extra tokens at end of #include directive
Error in : Dictionary generation failed!
In file included from AutoDict_random_access_iterator_test_long_.cxx:2:
/home/homelocal/GeomRoo/./AssemblageThomas.C:28:18: warning: extra tokens at end of #include directive[/code]
typedef struct test { // add the “test” name into the struct/union/enum tag namespace
int id, type, number;
} test; // add the “test” name into the typedef namespace
void trial(void) { // don’t call it “main” unless it’s a standalone application
//…
std::vector v;
//…
}[/code]
Unfortunately, that did not solve the problem.
I think that comes from vector. I did not precise: my root version is 5.30. Maybe vector of structure is not implemented in this version ?
Maybe try to replace “struct” with “class” (should be exactly the same, but you might need to add “public:” inside).
I see no problems with ROOT 5.30/05.
I have no idea what happens. Let’s wait for Philippe.
In the meantime, maybe you should have a careful look at:
/home/homelocal/GeomRoo/./AssemblageThomas.C:28:18: warning: extra tokens at end of #include directive
Add: #include "TSystem.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMedium.h"
#include "TGeoVolume.h"
#include "TGeoPgon.h"
Then I get: root [0] .x test.cxx
Info in <TGeoManager::TGeoManager>: Geometry test_conditions, Boundary Conditions Test created
Info in <TGeoManager::SetTopVolume>: Top volume is world. Master volume is world
Info in <TGeoManager::CheckGeometry>: Fixing runtime shapes...
Info in <TGeoManager::CheckGeometry>: ...Nothing to fix
Info in <TGeoManager::CloseGeometry>: Counting nodes...
Info in <TGeoManager::Voxelize>: Voxelizing...
Info in <TGeoManager::CloseGeometry>: Building cache...
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
Info in <TGeoManager::CloseGeometry>: 1 nodes/ 1 volume UID's in Boundary Conditions Test
Info in <TGeoManager::CloseGeometry>: ----------------modeler ready----------------
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
I think it is now working for me…
I do not understand!
Without this vector, all is perfectly working. With this vector i need to add TGeoMedium, TGeovolume …etc
In case of “magic” problems, always try to precompile your macro with ACLiC (i.e. “.L test.cxx++”) -> this will help to reveal the majority of problems.
In the “current” case … when building the dictionary (“AutoDict_*”) for the “test” vector, the whole “test.cxx” file was being #included, because that’s where the “test” structure was defined, and then the compiler was failing (so one needed to add all required includes).
Typically, for every ROOT class that you use in your source code, there should be a corresponding #include (usually with the same name as the class itself plus “.h”).
Also, watch the error messages from the compiler (e.g. when called by ACLiC) which will complain about:
… error: ‘SomeVariable’ was not declared in this scope
… error: expected type-specifier before ‘SomeClass’
… error: expected ‘;’ before ‘SomeAnotherClass’
Then you typically need to: #include “ClassOfSomeVariable.h” // for “SomeVariable” #include “SomeClass.h” #include “SomeAnotherClass.h”
[quote]Without this vector, all is perfectly working. With this vector i need to add TGeoMedium, TGeovolume …etc[/quote]CINT has trouble with interpreting std::vectors, so we switch to automatically compile the templates whenever we can. In your case this means that once you add a vector, the script in which your declared the type of the content a the vector will be compiled (instead of being interpreted). This compilation in turn requires that the script compiles strictly with the C++ standard.