0
votes

i use eclipse to run c language program

after build project,it print

Building target: testusb Invoking: Cross GCC Linker gcc -L/opt/local/lib -lusb-1.0 -o "testusb" ./src/testusb.o Finished building target: testusb

14:44:40 Build Finished (took 120ms)

14:44:49 **** Incremental Build of configuration Debug for project testusb **** make all make: Nothing to be done for `all'.

14:44:49 Build Finished (took 68ms)

14:45:10 **** Incremental Build of configuration Debug for project testusb **** make all make: Nothing to be done for `all'.

14:45:10 Build Finished (took 65ms)

in terminal when i cd the directory and type testusb,it print success.

enter image description here

but when i debug use eclipse,it not print success and cannot step into main breakpoint. enter image description here

the debug configure is enter image description here enter image description here

the project structure is enter image description here the program is

#include <stdio.h>
#include <stdlib.h>
#include <libusb-1.0/libusb.h>
int main(void) {
    libusb_context **libcontext;
    libusb_device ***deviceList;
    int status = libusb_init(libcontext);
    if (status == 0) {
//      libusb_get_device_list(*libcontext,deviceList);
        printf("success");
    }

}

my question is why debug cannot step into breakpoint and cannot print success?

1
which version of eclipse are you using?Aemyl
Eclipse IDE for C/C++ Developers Version: Mars.2 Release (4.5.2)Amitābha

1 Answers

0
votes

i found the reason is eclipse default support gdb,but mac is ggdb.i try the solution Eclipse CDT cannot debug using gdb on Mac but apple-gcc42 is not supported on OS X versions newer than El Capitan,my mac is macos sierra

i change xcode enter image description here

i add enter image description here enter image description here

it can debug! enter image description here

reference Linking Libraries in Xcode

ld: library not found for -lGoogleAnalytics