At the moment I am using QtCreator 2.8.1 based on Qt 5.1.1 under Ubuntu Linux. I do both, Qt Development and coding pure C++ projects. Because I don't want to install a second heavyweight IDE like Eclipse for latter I'd like to use QtCreator for that.
Up to now I created a new C++ Project (without Qt) by clicking on File->New->C/C++ Project (without Qt)->C++-Project. So now coding works fine. But with my first build I discovered a huge problem with my main.cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream infile("file1.in");
string line;
while(infile >> line) {
cout << line << endl;
}
cout << "hello world" << endl;
return 0;
}
When I run this within QtCreator I see only "hello world" on the console, but nothing more (file1.in contains more than 20 lines of raw text). Now the strange thing. After compiling this with a little g++ main.cpp I see all my 20 lines of text and "hello world".
Does anybody have a clue why this happens? I thought I have to change the compiler in QtCreator, but this attempt wasn't successfully.
shadow buildto be sure that Arne is right. - Kakadumake clean distclean(easiest from command line) in the source directory, to make sure compiler doesn't end up using stale files from there at some situation. Also, I'd prefer using shadow build, it allows doing debug and release builds without needing tocleanin between (especially useful, if you have more targets than just plain debug and release). - hyde