mercredi 29 avril 2015

Super basic C++ Error

I have this code...

#include <stdio.h>
#include <wiringPi.h>

#include <fstream>
#include <iostream>

int main ()
{

  wiringPiSetup ();

  char instructions[100];

  ifstream b_file ( "instructions.txt" );
  b_file>> instructions;
  cout<< instructions <<"\n";

}

As far as I understand it, this should compile to a program that outputs the contents of "instructions.txt" in the console...however, it won't even compile with g++ in Ubunutu...what's wrong?

Error messages tell:

"if_stream" wasn't declared in this scope
"b_ file" wasn't declared in this scope
"cout" wasn't declared in this scope.

Aucun commentaire:

Enregistrer un commentaire