This is my header files included
Code: Select all
#include <irrlicht.h>
#include <iostream>
#include <fstream>
#include <string>
Code: Select all
string line;
ifstream myfile2 ("example.txt");
if (myfile2.is_open())
{
while (! myfile2.eof() )
{
getline (myfile2,line);
cout << line << endl;
}
myfile2.close();
}
else cout << "Unable to open file";
Irrlicht header then it works but when I inlclude the Irrlicht Header File I get this in the output:
E:\Pokemon\PokeMap Editor\main.cpp(154) : error C2872: 'string' : ambiguous symbol
E:\Pokemon\PokeMap Editor\main.cpp(154) : error C2955: 'string' : use of class template requires template argument list
h:\irrlicht-1.4\include\irrstring.h(862) : see declaration of 'string'
E:\Pokemon\PokeMap Editor\main.cpp(154) : error C2133: 'line' : unknown size
E:\Pokemon\PokeMap Editor\main.cpp(154) : error C2512: 'string' : no appropriate default constructor available
E:\Pokemon\PokeMap Editor\main.cpp(154) : error C2262: 'line' : cannot be destroyed
E:\Pokemon\PokeMap Editor\main.cpp(161) : error C2780: 'class std::basic_istream<_E,_Tr> &__cdecl std::getline(class std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &,const _E)' : expects 3 arguments - 2 provided
c:\program files\microsoft visual studio\vc98\include\string(149) : see declaration of 'getline'
E:\Pokemon\PokeMap Editor\main.cpp(161) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::getline(class std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument for 'class std::basic_istre
am<_E,_Tr> &' from 'class std::basic_ifstream<char,struct std::char_traits<char> >'
E:\Pokemon\PokeMap Editor\main.cpp(161) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::getline(class std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument for 'class std::basic_strin
g<_E,_Tr,_A> &' from 'class irr::core::string'
E:\Pokemon\PokeMap Editor\main.cpp(162) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class irr::core::string' (or there is no acceptable conversion)
sorry I know its a lot
Anyway I thing the string header included is interfering with the string
class in irrlicht, and the string type is mistaken for the Irrlicht string instead of the string included in the string header, and then it is using that type for the 'line' in the:
getline (myfile2,line);
causing an error.
how can I include the string header without it causing errors with the Irrlicht string class?