C ++程序在IDE中运行,但不在Mac Terminal中运行

时间:2018-11-01 22:56:18

标签: c++ c++14

因此,由于我仍在学习C ++,所以我写了一个基本的C ++程序。该代码在我在IDE中构建和运行时有效,可以打开一个可以正常工作的终端。

但是,当我获取文件并在终端中运行它时,它不起作用,这是我得到的错误。任何帮助将非常感激。

PS:告诉我的教授,我正在为该课程运行最新的C ++标准,所以我现在不再那么想。

下面我已经链接了我正在做的事情,也许您可​​以告诉我我在做错什么。

谢谢

要运行:

 //alpha numeric characters, - and _
 let regex = try NSRegularExpression(pattern: "{[a-zA-Z0-9-_]}", options: .caseInsensitive)

var text = "the {animal} jumped over the {description} fox"
let all = NSRange(location: 0, length: text.count)

regex.enumerateMatches(in: text, options: [], range: all) { (checkingResult, matchingFlags, _) in
    guard let resultRange = checkingResult?.range else {
        print("error getting result range")
        return
    }
    //at this point, i was hoping that (resultRange.lowerbound, resultRange,upperBound) would be the start and end index of my regex match. 
    //so print(text[resultRange.lowerBound..<resultRange.upperBound] should give me {animal}
    //so i could get the word between the curly braces, and replace it in the sentence with it dictionary value         
}

这是我的错误图片

enter image description here

这是我的代码:

g++ -Wall main.cpp -o main
./main

0 个答案:

没有答案
相关问题