Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the working directory in Xcode

Tags:

xcode

gdb

I managed to get my C++ project running in Xcode using cmake -G Xcode. Now I would like to debug it, because of the nice gdb fronted it provides.

However I need to change the working directory where gdb is executed otherwise it wont work. (It needs to read some data from files relative to the path of the working directory) What I can do is after gdb has stopped typing cd working_dir and then run it manually typing r. This works, but Xcode will complain constantly and is also not an elegant solution.

So somewhere in the build settings I should be able to set the working directory..but where?!

like image 646
Nils Avatar asked Aug 03 '10 12:08

Nils


People also ask

How do I change the working directory of a file?

Answer: Use the cd Command The current working directory is the directory or folder where you are currently working. You can use the cd (change directory) command to change the current working directory or move around the file system. This command will work in all Linux distribution.

How do I find a folder in Xcode?

It should by located in: ~/Library/Developer/Xcode/DerivedData . Show activity on this post. You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.

How do I add an existing folder to Xcode project?

Xcode offers several ways to add existing files and folders to your project: Drag the files from the Finder into the Project navigator. Click the Add button (+) in the Project navigator's filter bar, and choose Add Files to “projectName”. Choose File > Add Files to “projectName”.

What is Srcroot?

$(SRCROOT) (aka $(SOURCE_ROOT) ) is a path to your location where a . xcodeproj is. It is simple to check, just put it in a field and Xcode gives you a tip.


2 Answers

Just updating this solution to XCode 4.x

You go on Product -> Scheme -> Edit Scheme

On the tab Options you choose your working directory.

like image 163
gibertoni Avatar answered Sep 23 '22 10:09

gibertoni


In Xcode 4 the working directory settings is under Scheme Settings.

like image 25
avee Avatar answered Sep 25 '22 10:09

avee