On the assumption that std::cout<<"error"; is because "file not found" and not something like "permission denied", you need to make sure there is actually a file called data.csv in the current directory.
Typically, you're either
- looking in the wrong place, or at least where you don't expect.
- you have that god-awful M$ "efficiency" known as "hide known extensions" and your file is really called data.csv.txt