Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I not able to use relative path to open a file in CLion?

I seem to get errors when trying to open an std::ifstream if I use a relative path. Though it works fine if using an absolute path.

Is there something I need to add to the CMakeLists.txt? (I'm pretty new to using cmake) Or is it just a problem in CLion?

like image 385
SuperWig Avatar asked Mar 24 '15 14:03

SuperWig


1 Answers

It's CLion. You have to set the Working Directory in your compilation options. (under run > edit configurations)
For example: Settings Screenshot

Because CLion works in an other directory on ubuntu under ~/.clion10/system/cmake/generated/[id_of_project]

like image 142
Waxo Avatar answered Nov 10 '22 02:11

Waxo