[VS 2005 Express]Problème de compilation avec un ofstream
Bonjour,
En cherchant à compiler le code suivant (sous VS 2005 express) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
#include "stdafx.h"
#include <ostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::ofstream os;
os << "Goodbye!" << std::endl;
return 0;
} |
j'obtiens l'erreur suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
c:\documents and settings\moi\mes documents\visual studio 2005\projects\test\test\test.cpp(9) : error C2079: 'os' uses undefined class 'std::basic_ofstream<_Elem,_Traits>'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\moi\mes documents\visual studio 2005\projects\test\test\test.cpp(11) : error C2297: '<<' : illegal, right operand has type 'const char [9]'
c:\documents and settings\moi\mes documents\visual studio 2005\projects\test\test\test.cpp(11) : error C2563: mismatch in formal parameter list
c:\documents and settings\moi\mes documents\visual studio 2005\projects\test\test\test.cpp(11) : error C2568: '<<' : unable to resolve function overload
c:\program files\microsoft visual studio 8\vc\include\ostream(971): could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
with
[
_Elem=wchar_t,
_Traits=std::char_traits<wchar_t>
]
c:\program files\microsoft visual studio 8\vc\include\ostream(963): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\program files\microsoft visual studio 8\vc\include\ostream(937): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' |
Malgré mes recherches, je ne comprends pas l'origine de l'erreur. Quelqu'un pourrait-il m'aiguiller ?