CodeLite IDE is not reading file

Solution 1:

Codelite generates $(project).txt ($(project) is Test in your case) with all objects filename for compilation (as response file (to bypass limit of command line length when there are too many files)).

Either place project in another directory or rename the file or project to avoid the conflict with that file.

Solution 2:

This is happening because you haven't use/printed the data variable. Use this code

#include<iostream>
#include<fstream>
#include<string>

using namespace std;

int main(){
    string data;
    ifstream infile;
    infile.open("test.txt");

    cout<<"Reading from file"<<endl;

    while (getline(infile,data))
    {
        cout<<data<<endl;
    }
    
    return 0;
}