I am new to Xcode, and I simply want to see if it is possible to use an executable file in Xcode. To test this, I have a very simple C++ code that prints the user's input to the screen.
I am working with a swift-based project in Xcode 10. In the project build settings, I can see the linking section which seems like the appropriate place for a executable file to be placed, however all of the info I have found has been about generating an executable file from the Xcode project, which is the opposite of what I need (to incorporate an external executable file into my Xcode project). Here is the main code from the C++ file from which I generated the executable file.
int CPPTest::main(int argc, char* argv[])
{
int counter;
// printf("Program Name Is: %s", argv[0]);
if (argc == 1)
printf("\nNo Extra Command Line Argument Passed Other Than Program Name\n");
if (argc >= 2)
{
printf("\nNumber Of Arguments Passed: %d", argc);
printf("\n----Following Are The Command Line Arguments Passed----\n");
for (counter = 0; counter<argc; counter++)
printf("argv[%d]: %s\n", counter, argv[counter]);
}
// system("pause");
return 0;
}
I would greatly appreciate step-by-step instructions as to how to link my executable file with my Xcode project, and to be able to call the main function and pass the parameters.