【问题标题】:Trying to Debug C++ Program on Eclipse Mars on MAC Pro Retina with OS X Yosemite Version 10.10.5尝试使用 OS X Yosemite 版本 10.10.5 在 MAC Pro Retina 上的 Eclipse Mars 上调试 C++ 程序
【发布时间】:2015-12-23 20:15:57
【问题描述】:

我正在尝试在 Eclipse Mars 中的新 Mac 上调试 C++ 程序。

我能够构建项目(生成输出文件)。

我能够作为不生成输出文件的“本地 C++ 应用程序”运行,但它似乎正在成功完成。

但我无法像它所说的那样调试......

我在“调试配置”中尝试了不同的选项,但没有运气...

'无法使用命令确定 GDB 版本:/usr/bin --version' ...

'没有这样的调试器'

创建会话时出错 无法运行程序“gdb”:未知原因 无法运行程序“gdb”:未知原因 无法运行程序“gdb”:未知原因

无法使用命令确定 GDB 版本:/usr/bin --version

“启动命令时出错:gdb --version”

我做错了什么?任何帮助将不胜感激。

 /*

 E-Mail : ahmed.aly.tc@gmail.com
 TopCoder Handle : ahmed_aly

 Just For You :)

 */

#include <cstring>
#include <string.h>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>

using namespace std;

#define pb push_back
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz size()
#define rep(i,m) for(int i=0;i<(int)(m);i++)
#define rep2(i,n,m) for(int i=n;i<(int)(m);i++)
#define For(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();++it)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define dot(a,b) ((conj(a)*(b)).X)
#define X real()
#define Y imag()
#define length(V) (hypot((V).X,(V).Y))
#define vect(a,b) ((b)-(a))
#define cross(a,b) ((conj(a)*(b)).imag())
#define normalize(v) ((v)/length(v))
#define rotate(p,about,theta) ((p-about)*exp(point(0,theta))+about)
#define pointEqu(a,b) (comp(a.X,b.X)==0 && comp(a.Y,b.Y)==0)

typedef stringstream ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int> > vii;
typedef long long ll;
typedef long double ld;
typedef complex<double> point;
typedef pair<point, point> segment;
typedef pair<double, point> circle;
typedef vector<point> polygon;

const int oo = (int) 1e9;
const double PI = 2 * acos(0);
const double eps = 1e-9;

inline int comp(const double &a, const double &b) {
    if (fabs(a - b) < eps)
        return 0;
    return a > b ? 1 : -1;
}

int di[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dj[] = { 0, 0, 1, -1, 1, -1, -1, 1 };
int diK[] = { -2, -2, -1, 1, 2, 2, 1, -1 };
int djK[] = { -1, 1, 2, 2, 1, -1, -2, -2 };

int I, J;

inline bool val(const int &i, const int &j) {
    if (i < 0 || j < 0 || i >= I || j >= J)
        return false;
    return true;
}

int N;
int n;


int arr[2009];
//#define SMALL
#define LARGE
int main() {
    freopen("a.txt", "rt", stdin);
#ifdef SMALL
    freopen("A-small-attempt0.in","rt",stdin);
    freopen("A-small.out","wt",stdout);
#endif
#ifdef LARGE
    freopen("A-large.in","rt",stdin);
    freopen("A-large.out","wt",stdout);
#endif

    int c;
    cin >> N;
    rep2(nn,1,N+1) {
        cin>>c>>n;
        rep(i,n)
            cin>>arr[i];

        printf("Case #%d: ", nn);
        rep(i,n)
            rep2(j,i+1,n)
                if(arr[i]+arr[j]==c){
                    cout<<i+1<<" "<<j+1<<endl;
                    goto END;
                }
        END:;
    }
    return 0;
}

【问题讨论】:

  • 我继续面临上述问题。在这方面的任何帮助将不胜感激。谢谢...

标签: c++ eclipse macos debugging gdb


【解决方案1】:

Apple 已经有一段时间没有提供 gdb 及其工具了。您可以下载并构建 FSF gdb,但我不知道它在 OS X 上的效果如何。Apple 为它在当天发布的 gdb 版本添加了许多功能,但从未进入 FSF 源代码库。

Apple 当前支持的调试器是 lldb。您还可以通过 lldb-mi 驱动程序在 Eclipse 中使用 lldb。例如,这里描述了这样做:

https://www.codeplay.com/portal/lldb-mi-driver---part-2-setting-up-the-driver

请注意,如果您有 Xcode 7.x,它现在在 Xcode.app/Contents/Developer/usr/bin/lldb-mi 中包含 lldb-mi 驱动程序,因此您不必执行这些步骤在上面的 2.1 中。

【讨论】:

    猜你喜欢
    • 2015-11-28
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2014-12-14
    • 2015-10-30
    • 2015-01-03
    • 1970-01-01
    • 2016-10-25
    相关资源
    最近更新 更多