profile pic

Precise Asteroid

Welcome to Amir's Blog 👋

Cmake, Xcode and working directory


The 3rd project in the C++ required running a chatbot. Now in the 2nd one I an Ubuntu instance using Multipass, but since I think that running it through SSH with visula graphic interface is too much to where I am at.

Since I had issues with debugging C++ with VScode on a mac, I oped again for XCode. At least dbugging is easy pissy with it.

Wasn't easy as I thought.

First thing was to get a Cmake File into Xcode. That was rather straigt forward.

  • Where is the source code: just point to the folder
  • Where is the build: Just create a folder underneath ht. I called it xcode.

Cmake Now just click configure, generate (pick Xcode from the list) and hit Open Project, which would in turn open your project in Xcode.

The next thing took more time. I was able to build with xcode but it kept on failing when trying to run.

What's more interesting was I was able to run the excecutable form the terminal, which was very strange.

After some trial and error I realized that the problem occurs when the working directory is the same as the executable one. It seems that that's the default behavior of Xcode


In order to fix it one need to change the working directory of the Run step.

Edit Schema

working directory

From that point and one I could run and debug...

Made by Amir 💚