CLion C++ can't read/open .txt file in project directory

后端 未结 6 1101
半阙折子戏
半阙折子戏 2020-12-09 17:25

I have a .txt file in my project directory that I made and populated with data.

directory structure looks like:

/Users/asd/ClionProjects/ProjectWithT         


        
6条回答
  •  北海茫月
    2020-12-09 17:50

    I'm going to presume that the working directory is being set to the path to the executable file instead of your CMakeLists.txt file.

    To fix this, EITHER:

    1. put the .txt next to the executable file
    2. Explicitly set the working directory for debugging
    3. Enter the full path to the .txt file as explained in ti7's answer.

提交回复
热议问题