Utilisation de istrstream ou istringstream
Bonjour,
Je me tourne vers vous à cause d'un problème pour le moins surprenant...istrstream et istringstream n'existent pas 8O
Je m'explique, voici un code simple :
Code:
1 2 3 4 5 6 7
| #include <iostream>
#include <sstream>
#include <string>
int main(void) {
istringstream str("coucou");
} |
en le compilant, j'obtient ceci
Code:
1 2 3 4
| > g++ -o prog.o -c prog.cpp
prog.cpp: In function 'int main()':
prog.cpp:6: error: 'istringstream' was not declared in this scope
prog.cpp:6: error: expected `;' before 'str' |
et en utilisant istrstream:
Code:
1 2 3 4 5 6
| #include <iostream>
#include <strstream>
int main(void) {
istrstream str((char*)"coucou");
} |
j'ai ça comme erreur:
Code:
1 2 3 4
| > g++ -o prog.o -c prog.cpp -Wno-deprecated
prog.cpp: In function 'int main()':
prog.cpp:5: error: 'istrstream' was not declared in this scope
prog.cpp:5: error: expected `;' before 'str' |
(je vous épargne le warning qui dit que c'est déprécié ^^)
Quelqu'un a déjà eu un problème similaire ? Y a-t-il une solution ? C'est bizarre quand même, c'est un truc du langage ça, c'est comme si il trouvait pas string non?
Ou bien il faut installer un truc? :?
Merci pour votre aide :D
EDIT:
QUE LA HONTE SOIT SUR MOI >.<
j'ai oublié le namespace ^^"
Donc :
Code:
1 2 3 4 5 6
| #include <iostream>
#include <strstream>
int main(void) {
std::istrstream str("coucou");
} |
ça marche :D
et
Code:
1 2 3 4 5 6 7
| #include <iostream>
#include <sstream>
#include <string>
int main(void) {
std::istringstream str("coucou");
} |
ça marche tout aussi bien ^_^
Désolé d'avoir créé un sujet pour trouver la solution 3 secondes après -_-
Peut-être que ça aidera quelqu'un :mrgreen: