C++ Final executable with ifstream file requirements

时间:2016-10-20 13:24:30

标签: c++ makefile executable filestream

So I have a query I haven't been able to find the answer for. I'm using Atom as a text editor and I have a makefile to compile my program. In my program I have reading from two text files using std::ifstream & std::sstream. When i compile my program using makefile and then run the program while my terminal is in that directory everything works perfectly.

BUT... when I dont use the terminal and I navigate to the run unix executable through folders and run the program, it cannot load the two text files.

I was wondering how do programmers go about this conundrum to produce a final program? Is there a way you can statically link files inside the program like you can with library headers so you don't have this issue?

0 个答案:

没有答案