" 'istream' has not been declared " ERROR Help

I have this code and these errors.

istream.cpp:36: error: 'istream' has not been declared
istream.cpp: In function 'int get()':
istream.cpp:38: error: 'm_gcount' was not declared in this scope
istream.cpp:39: error: 'getch' was not declared in this scope
istream.cpp:41: error: 'failbit' was not declared in this scope
istream.cpp:41: error: 'setstate' was not declared in this scope
istream.cpp: At global scope:
istream.cpp:55: error: expected constructor, destructor, or type conversion before '&' token
istream.cpp:75: error: expected constructor, destructor, or type conversion before '&' token

There is the code:

// Arduino SdFat Library
 [b]#if defined (ARDUINO) && ARDUINO >=100
  #include <Arduino.h>
#else
  #include <float.h>
  #include <istream.h>
  #include <istream.cpp>
#endif         [/b]     [b] // That I modified from just  [/b]#include <float.h>  #include <istream.h>[b] thinking it would help.[/b]
//------------------------------------------------------------------------------
/**
 * Extract a character if one is available.
 *
 * \return The character or -1 if a failure occurs.  A failure is indicated
 * by the stream state.
 */
 
[b]int istream ::get() {[/b]                                    [b] //There is the beginning of the  problem[/b]
  int c;
  m_gcount = 0;
  c = getch();
  if (c < 0) {
    setstate(failbit);
  } else {
    m_gcount = 1;
  }
  return c;
}
//------------------------------------------------------------------------------
/**
 * Extract a character if one is available.
 *
 * \param[out] c location to receive the extracted character.
 *
 * \return always returns *this. A failure is indicated by the stream state.
 */
istream & istream::get(char & c) {
  int tmp = get();
  if (tmp >= 0) c = tmp;
  return *this;
}
//------------------------------------------------------------------------------

I want to upload this to a Teensy 2.0 to run an SD card reader to stream data.
Can you help me figure out why it won’t work? Thank you.

The istream library needs to be installed properly and #included in order for your code to compile. Looking at your code, will the library always be #included ? Where is it installed ? Did you stop/start the IDE after installing the library ?

Someone once wrote on this forum that "copy and paste" should be disabled in the IDE, I'm starting to think of how right he is.

I just started programming for my Senior Project. I know almost nothing about it. I downloaded codes and libraries from an instructable to run WS2801 LEDs and I can’t seem to fix this problem.

I installed the libraries in the same folder as the Arduino without any subfolders. All the other libraries are up on the code and compiled, but this “istream” one doesn’t.
The library, I think, should indeed always be included.
I did stop/start the IDE.

Thanks for the reply.

I installed the libraries in the same folder as the Arduino without any subfolders

Then you did not install the libraries you just put them some place. See this for how to do it. http://www.lmgtfy.com/?q=arduino libraries installing

Grumpy_Mike:

I installed the libraries in the same folder as the Arduino without any subfolders

Then you did not install the libraries you just put them some place. See this for how to do it. http://www.lmgtfy.com/?q=arduino libraries installing

I just did it. Still the same errors...

And did you restart the IDE after you installed them?

[/b] **// That I modified from just ** #include <float.h> #include <istream.h> thinking it would help.

And have you put that back to how you found it?

#endif         [/b]     [b] // That I modified from just  [/b]#include <float.h>  #include <istream.h>[b] thinking it would help.[/b]
//------------------------------------------------------------------------------
/**
 * Extract a character if one is available.
 *
 * \return The character or -1 if a failure occurs.  A failure is indicated
 * by the stream state.
 */
 
[b]int istream ::get() {[/b]                                    [b] //There is the beginning of the  problem[/b]
  int c;

For C code, that is hard to read.

You can’t bold inside code blocks.

Grumpy_Mike:
And did you restart the IDE after you installed them?

[/b] **// That I modified from just ** #include <float.h> #include <istream.h> thinking it would help.

And have you put that back to how you found it?

I did. I did it again and again and again. I redownloaded the codes, rearranged them in a new folder (Twice) and still istream has not been declared.

istream.cpp:38: error: 'm_gcount' was not declared in this scope

In my copy of SDfat that variable does not exist.

In istream.cpp, istream::get is already declared, so why are you declaring it again?

int istream::get() {
  int16_t c;
  gcount_ = 0;
  c = getch();
  if (c < 0) {
    setstate(failbit);
  } else {
    gcount_ = 1;
  }
  return c;
}
#if defined (ARDUINO) && ARDUINO >=100
  #include <Arduino.h>
#else
  #include <float.h>
  #include <istream.h>
  #include <istream.cpp>
#endif

Since the Arduino version is, by now, >= 100, you are not including istream.h or istream.cpp.

I downloaded the code pre-made as an open source code. Can you guide me to make it work? I have no experience whatsoever in this. I taught it would be ready to fire up direcly after download…

Thank you for the reply!

Will08: I just started programming for my Senior Project. I know almost nothing about it. I downloaded codes and libraries from an instructable ...

Will08: I downloaded the code pre-made as an open source code. Can you guide me to make it work?

It's time to get a little more specific. What instructable? Give a link please. What file did you download? What version of the IDE are you using?

How to use this forum

[quote author=Nick Gammon link=topic=206071.msg1517201#msg1517201 date=1387765761]

Will08: I just started programming for my Senior Project. I know almost nothing about it. I downloaded codes and libraries from an instructable ...

Will08: I downloaded the code pre-made as an open source code. Can you guide me to make it work?

It's time to get a little more specific. What instructable? Give a link please. What file did you download? What version of the IDE are you using?

How to use this forum

[/quote]

http://www.instructables.com/id/PixelBrite/?ALLSTEPS I downloaded all the file that were mentionned in the Instructable. I am using the latest version of the IDE since I downloaded it a week ago.

Right. Well I'm done here. I stopped the download at about 80 Mb of files. There is no way all that will fit onto the Arduino.

If you aren't going to state which file you are compiling then I can't help you.

[quote author=Nick Gammon link=topic=206071.msg1517270#msg1517270 date=1387776373] Right. Well I'm done here. I stopped the download at about 80 Mb of files. There is no way all that will fit onto the Arduino.

If you aren't going to state which file you are compiling then I can't help you. [/quote]

Oh. I see. It's OK. Anyways, I don't know how I did it exacly, and I still have to see if it will run OK, but it compiled! So I'm done here too. btw, I'm using a Teensy 2.0.

Thanks everyone.