2017-08-11 13 views
-1

我真的需要在Xcode中使用调试器,但我无法做到这一点。我使用Mac上的终端来编译一个文件,我通常只是更改目录,然后我有.sh文件,然后我写下来并编译所有内容,注意这是.sh文件中的内容:与Xcode运行.sh文件,我使用终端和一切工作,不知道如何使用Xcode

#!/bin/bash 
clear 

echo "cleaning directory" 
rm mag_test.out 

echo "Compiling mag_cal_driver.c" 
g++ -o mag_test.out mag_cal_driver.c ../src/mag_utils.c 

echo -e "Running magnetometer tests\n" 
./mag_test.out 

我该如何在Xcode中实现这个?注意代码在c! enter image description here

enter image description here

+0

你是什么版本的Xcode发挥执行按钮? –

+0

该版本是8.3.3 –

回答

0

对于

rm mag_test.out 

在MAC

make clean 

将文件保存为.c和类型在终端:

gcc -o yourfilename yourfilename.c 

make yourfilename 

后来才像这样运行可执行文件:

./yourfilename 

为了调试

您可以使用LLDB

$ lldb yourfilename 

破发点

$breakpoint set --file yourfilename .c --line 12 

最好是用于调试(IDE)的Xcode接口

安装LLDB遵循 LLDB INSTALLATION

对于指南使用 LLDB GUIDE

如果你想使用的Xcode IDE按照循序渐进 1.启动xcode

  1. 选择Create new Xcode Projec牛逼

  2. 选择命令行工具

command line

4.Select语言

Language selection

5.创建并添加文件和断点,只要你喜欢(蓝色箭头标记为调试断点)

6。之后,只是在最顶端左上角

debug

+1

嘿没有任何机构实际上读取我写的内容,我知道如何编译它,就像你在.sh文件中看到的那样,确切地说!我如何在xcode中做到这一点?我需要使用调试器! –

+0

如果你想调试使用xcode IDE –

+0

mybe我写它不好,但我知道如何使用终端编译它,如何在xcode中编译它,所以我可以使用Xcode调试器? –

相关问题