簡體   English   中英

嘗試使用OS X Yosemite版本10.10.5在MAC Pro Retina上的Eclipse Mars上調試C ++程序

[英]Trying to Debug C++ Program on Eclipse Mars on MAC Pro Retina with OS X Yosemite Version 10.10.5

我試圖在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;
}

蘋果已經很長時間沒有將gdb與它的工具一起交付了。 您可以下載並構建FSF gdb,但我不知道它在OS X上的運行情況如何。Apple為其發布的gdb版本增加了很多功能,但該功能從未出現在FSF源碼庫中。

蘋果目前支持的調試器是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中的步驟。 。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM