Export for mac/windows from xcode

Joined
Aug 30, 2014
Messages
20
Reaction score
0
Points
1
I have been trying to search on how I can script (right now just 1 C/.m file) and export the file for direct use on the windows and mac. (An application that will just run in the terminal/console using just C) I am new to C programming, and do not understand how to create a simple file that directly opens up in the terminal/console. ( I have tried opening the .c file created by XCode, but nothing happens)
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
To create a Terminal / Console project in Xcode.

Open Xcode and choose Create a New Xcode Project in the Dialog Window.
Then navigate to OSX Application in the left window pane,
Then select Command Line Tool, and click the Next Button.
Give the project a Name in the next Dialog Window, and enter an orginisation Name if you like.
Then select the C language from the Language pull down box at the bottom.
Then the new project will open automatically in the project window.

Please be aware that a command line tool created with Xcode will probably only compile for Mac, and may not run on windows,
although there may be compiler settings to enable this, but not sure what these are, as I hav'nt programmed for Windows in a long time.

Regards Mark
 
OP
G
Joined
Aug 30, 2014
Messages
20
Reaction score
0
Points
1
Alright, so if i figure out how to do the gcc command for compiling a .c file, how would i compile a large project that uses multiple files, into one. I was pplnning on working on a project which would use mutliple seperate files.
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
You dont have to figure out the GCC commands if your using Xcode for the project, you can compile any project directly in Xcode itself, but knowing what compiler flags to set inorder for your project to compile for Windows is what you need to know, and I can't help you with that one.

to have project with more than one file, simply add additional files with Xcode's File -> New -> File menu, and select the type of file you wish from the templates, if you select the Source templates, there is one for new C files.

Regards mark
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
Yes I understood that, but you can use the GCC compiler from within Xcode is what I meant.
By default I think Xcode uses the LLVM compiler, but you can choose to use the GCC compiler from the Build Setting area of your Xcode project.

Be sure to use only standard C libraries in your code base if you want to compile for different platforms, If you utilise any Mac specific libraries or frameworks then your code won't run on a Different operating system.

Regards Mark
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top