Help with error in code template functions


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
There is such code:

#define GDMLExtReader_H 1 #ifndef _WIN32 #include 
#endif GDMLExtReader class : public G4GDMLReadStructure { template Type* GetPtr(const G4String& name, const std::map& l) { Type* ret = 0; std::map::is assigned to a const_iterator pos = l.find(name); if (pos != l.end()) ret = pos->second; else { G4String err_mess = "Attribute:" + name + " NOT found !"; G4Exception("GDMLExtReader", "ReadError", FatalException, err_mess); } return ret; } }; #endif

Visual Studio compiles and runs, but when you try to compile with gcc under Ubuntu falls out with an error:
In member function Type* GDMLExtReader::GetPtr(const G4String&, const std::map > >&)': include/GDMLExtReader.hh: error: expected ;' before pos' include/GDMLExtReader.hh: error: pos' was not declared in this scope 

If the function create a variable and not an iterator, i.e. std::map pos2, then everything works.
Error manifested when creating the iterator.
by | 4 views

1 Answer

0 like 0 dislike
#ifndef _WIN32
#include #endif
\r
and why the heck it is, or think that GCC will samoloty the library in the right place?
really stupid question and unwillingness to read what the compiler says
by

Related questions

0 like 0 dislike
2 answers
asked Apr 14, 2019 by sddvxd
0 like 0 dislike
2 answers
asked Apr 26, 2019 by DollyPapper
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
28,075 users