I did a bit of a research and found a solution. Visual Studio needs the <string> library to identify the getline command.
Here's the code refactored and fixed :
<pre>
#include <iostream>
#include <fstream> //Must have
#include <string> //Fixed with the string library
using namespace std;
int main(){
string mytext;
ifstream myreadfile("code.txt");
while (getline (myreadfile, mytext)){ cout<<mytext;
}
myreadfile.close();
return 0
;}