C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

erreur avec dev c++

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
giovanni
Guest





PostPosted: Sat Jan 15, 2005 10:36 pm    Post subject: erreur avec dev c++ Reply with quote



me dit erreur :
C:Dev-Cppmain.cpp In function `int main()':
45 C:Dev-Cppmain.cpp `TEXT' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it
appears in.)
45 C:Dev-Cppmain.cpp variable `std::ifstream input' has initializer but
incomplete type
C:Dev-CppMakefile.win [Build Error] [main.o] Error 1

#include <iostream>
#include <istream>
#include <ostream>
#include <sstream>
#include <string>

void display( int line_num , int v1 , int v2 , int v3 , int v4 ) {
std::cout
<< "# " << line_num << ":t"
<< "v1: " << v1
<< ", v2: " << v2
<< ", v3: " << v3
<< ", v4: " << v4
<< std::endl ;
}

void format_error( int line_num ) {
std::cerr << "Error at line " << line_num << "!n" ;
}

bool is_space( std::string const & s ) {
for ( std::string::const_iterator it = s.begin() ,
end = s.end() ;
it != end ;
++ it ) {
char c = * it ;
if ( ! std::isspace( c ) ) {
return false ;
}
}
return true ;
}

bool is_space( std::istringstream & iss ) {
for ( char c = iss.get() ; iss ; c = iss.get() ) {
if ( ! std::isspace( c ) ) {
return false ;
}
}
return true ;
}

int main() {
const char* nome_del_file = "c:/";
std::ifstream input(TEXT.TXT);
for ( int line_num = 1 ; input ; ++ line_num ) {
std::string line ;
std::getline( input , line ) ;


if ( is_space( line ) ) {
std::cout << "# " << line_num << ":tempty" << std::endl ;
continue ;
}

int v1 = 0 , v2 = 0 , v3 = 0 , v4 = 0 ;
std::istringstream iss( line ) ;
iss >> v1 >> v2 >> v3 >> v4 ;

if ( iss && is_space( iss ) ) {
display( line_num , v1 , v2 , v3 , v4 ) ;
}
else {
format_error( line_num ) ;
break ;
}
}
}


Back to top
Gabriel Dos Reis
Guest





PostPosted: Sat Jan 15, 2005 11:30 pm    Post subject: Re: erreur avec dev c++ Reply with quote



"giovanni" <giovannich (AT) hotmail (DOT) com> writes:

Quote:
me dit erreur :
C:Dev-Cppmain.cpp In function `int main()':
45 C:Dev-Cppmain.cpp `TEXT' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it
appears in.)
45 C:Dev-Cppmain.cpp variable `std::ifstream input' has initializer but
incomplete type
C:Dev-CppMakefile.win [Build Error] [main.o] Error 1

Le compilateur a tout dit.

Quote:
#include <iostream
#include #include #include #include

[...]

Quote:
int main() {
const char* nome_del_file = "c:/";
std::ifstream input(TEXT.TXT);

Tu voulais dire

std::ifstream input("TEXT.TXT");

note les guillemets. De plus il te faut

#include
en début de programme.


-- Gaby

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.