CLion无法查找文件

时间:2016-11-11 23:39:02

标签: c++ file io ifstream clion

使用CLion 2016.2.3时,即使我不使用相关目录,我也无法找到文件。当使用g ++编译编程时,它运行得很好但是CLION失败了让我相信这是CLion的一个问题..有什么建议吗?

#include<iostream>
#include<fstream>
using namespace std;

int main(int argc, char *argv[]) {

    ifstream file("C:\Users\Mackenzie\Desktop\Parser\test.asm");

    // segmentation fault at line above.. can't find file

    ifstream file("C:/Users/Mackenzie/Desktop/Parser/test.asm");

    // even with normal slashes this won't work

    // using relative directory ex "test.asm" also doesn't work

    return 0

}

CMake文件:

cmake_minimum_required(VERSION 3.5)
project(Parser)

set(CMAKE_CXX_STANDARD 11)

set(SOURCE_FILES parser.cpp)
add_executable(Parser ${SOURCE_FILES})

错误:

Program received signal SIGSEGV, Segmentation fault.
0x774d636d in ntdll!RtlAllocateHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll

0 个答案:

没有答案