开发者

stringstream was not declared in this scope

开发者 https://www.devze.com 2023-01-04 01:08 出处:网络
I\'m having problem with stringstream.my visual studio nor linux g++ can understand stingstream. I\'ve added sstream but it does\'nt solve anything. I\'ve worked with it before and really don\'t know

I'm having problem with stringstream.my visual studio nor linux g++ can understand stingstream. I've added sstream but it does'nt solve anything. I've worked with it before and really don't know what's up with it now?

#include <sstream>
#include <stdlib.h>
#include "SymbolTable.cpp"
#include "setjmp.h"
using namespace std;
jmp_buf *bfj;
int TOP , SP=3 ;
struct types{int int_val;float float_val;char char_val;bool bool_val;};

types DS[6400];
int开发者_开发知识库 main(){
...//some code here
label38 : stringstream s;
label39 : bfj = (jmp_buf *)"label65";
label40 : longjmp(*bfj,1);;
label41 : goto label43;
label42 : TOP=SP;
//some code here
}

I'm writing a compiler so the code is the output,that's why it may seams a bit odd.


If you include #include <sstream> then you must also reference the class by:

std::stringstream or declare using namespace std; before using it.

If you post more information we could provide more detailed help.


This code compiles fine for me under G++:

#include <sstream>
#include <stdlib.h>
#include "setjmp.h"
using namespace std;
jmp_buf *bfj;
int TOP , SP=3 ;
struct types{int int_val;float float_val;char char_val;bool bool_val;};

types DS[6400];
int main(){
label38 : stringstream s;
label39 : bfj = (jmp_buf *)"label65";
label40 : longjmp(*bfj,1);;
label41 : goto label43;
label42 : TOP=SP;
label43 : (void)0;
//some code here
}

The only difference is that I removed #include "SymbolTable.cpp", and added a label43.

So apparently, if it doesn't work for you, the problem is in some of the code you omitted. The //some code here parts or in SymbolTable.cpp

Of course, it also seems very suspicious that you're including a cpp file. That is most likely an error.

0

精彩评论

暂无评论...
验证码 换一张
取 消