problems with std::ifstream in code block on Ubuntu

hell, I am new to code blocks and programing in a linux enviroment

my issue is that my code worked find in VS 2010 but it does not work in Code Blocks running in Ubuntu. The problem that I have is

fstream f;
f.open("adsf"); ///at this point intellisense does not offer f.open so if I type f. nothing comes up and I have
#include<fstream>
#include <iostream>
#include <sstream>

using namespace std;

also I can not use std::fstream because fstream is not an option when I type std::

thank you for your help
If you want that kind of code completion then you can use eclipse: http://www.eclipse.org/downloads/

But using eclipse is not always easy.
Update to the latest Code::Blocks svn for more reliable code completion:
http://apt.jenslody.de/
Eclipse's code completion is still better, though - especially its C++11 support.

also I can not use std::fstream because fstream is not an option when I type std::

That's an interesting way of reasoning. Protip: it's possible to write "fstream" manually.
I did not think it was just a code completion problem because I ran the program using

ifstream file;
file.open("/home/HoF_G-ClF_G.csv");

and the file did not open. I am new to Linux. Did I use the correct file path? The program runs fine in VS 2010
Last edited on
That's probably a wrong path, I guess it should be "/home/rilesdg3/file". But you should know where is your file. (¿do you have reading permission?)

To avoid hardcoding, could use getenv("HOME");. Dunno what does that in windows, so perhaps there is a better way.
Last edited on
I got it to work, for the code completion problem I updated to a nightly build

for it to work with out the code completion I either had the path wrong(I don't think so) or it was I had
to add ios_base::in to file.open("filename", ios_base::in)

thank you for your responses
Topic archived. No new replies allowed.