我试图在Ubuntu 16.04上调试一个简单的"hello world"C++程序,但是gdb无法识别可执行文件格式.但是,我能够在命令行上成功运行可执行文件.这是代码
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我使用命令编译程序文件TestProject.cpp
g++ -g TestProject.cpp -o hello
Run Code Online (Sandbox Code Playgroud)
然后调试,我给出命令
gdb ./hello
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying" …Run Code Online (Sandbox Code Playgroud) 在诸如 C++ 之类的语言中,如果“if”语句中有多个条件,并且这些条件使用 AND(即&&)进行组合,那么只要其中一个条件为假,后续条件的求值就不会发生。Haskell 也是如此吗?例如,在下面的 Haskell 代码中,条件 A 为 FALSE,条件 B 的评估会发生吗?
fun :: Haxl (Maybe Bool)
fun =
if conditionA .&& conditionB
then return $ Just True
else return Nothing
Run Code Online (Sandbox Code Playgroud)