OiO.lk Blog C++ Xcode Arguments Passed On Launch won't load
C++

Xcode Arguments Passed On Launch won't load


I am building and running a simple Open MPI C application.
In order to run it, I configured the run process in this way:\

  1. Edit Scheme -> Run -> Info -> Executable -> Other… -> /path/to/mpiexec
  2. Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch -> -np 4 "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)"

Now, instead of the hardcoded "4" as the number of processes, I want to specify an environment variable (like the already existing BUILT_PRODUCTS_DIR and EXECUTABLE_NAME environment variables), so I enter in Environment Variables NUM_PROCS as Name and 4 as Value.
Thus, I write in Arguments Passed On Launch the whole quoted string:
"-np" "$(NUM_PROCS)" "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)".
And Xcode can’t read the NUM_PROCS environment variable (despite I can easily read it in the C program by a getenv("NUM_PROCS")!), in fact, it runs the default number of processes of my system (12).

I tried in a very large number the different ways of writing arguments (every string on a new line, with quotes, without quotes, …), but none worked as I expected.



You need to sign in to view this answers

Exit mobile version