I am trying to debug below C++ Program on my new Mac in Eclipse Mars.
I am able to Build Project (which generates an Output File).
I am able to Run as 'Local C++ Application' that does NOT generate Output File but it seems to be completing successfully.
But I am unable to Debug as it says ...
I tried different Options in 'Debug Configurations' but no luck ...
'Could not determine GDB version using command: /usr/bin --version' ...
'No such debugger'
Error creating session Cannot run program "gdb": Unknown reason Cannot run program "gdb": Unknown reason Cannot run program "gdb": Unknown reason
Could not determine GDB version using command: /usr/bin --version
"Error while launching command: gdb --version"
What am I doing wrong ? Any help would be much appreciated.
/*
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;
}
Apple hasn't shipped gdb with its tools for quite a while now. You can download and build the FSF gdb, but I have no idea how well that works on OS X. Apple added a lot of functionality to the version of gdb it shipped back in the day that never made it to the FSF source base.
The debugger Apple currently supports is lldb. You can also use lldb with Eclipse through the lldb-mi driver. Doing that is described for instance here:
https://www.codeplay.com/portal/lldb-mi-driver---part-2-setting-up-the-driver
Note that if you have Xcode 7.x, it now includes the lldb-mi driver program in Xcode.app/Contents/Developer/usr/bin/lldb-mi, so you don't have to go through the steps in 2.1 above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.