Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Developing on a macbook (http://www.mac-forums.com/forums/os-x-development-darwin/55416-developing-macbook.html)

boletje 03-04-2007 05:31 PM

Developing on a macbook
 
Decided to continue what i began learning about 2 months ago, and that is the C language. So i hear that i need something called Apple Developer Tools.

After searching their site on the developer tools, i came across something called xcode 2.0 (approx. 960Mb). Is this what i need so that i can begin develpment programs on my macbook?

karudzo 03-04-2007 05:56 PM

Yes- it works great.

xstep 03-04-2007 09:12 PM

Xcode comes on your install disks, so you don't have to download the very latest from Apple. The downlaod requires an ADC membership of which they have a free version.

boletje 03-05-2007 02:18 PM

coding on mac
 
so i downloaded apple developer tools (Xcode 2) and installed it. I made doubly sure i had GCC 3.3 and 4.0 installed aswell as X11 but, i assume the main installer installs these rather then me having to go through every package manually.

I wrote a simple "Hello" program using the text editor "VI" in terminal. But..im a little unsure how to execute. normlly i did "a.out test" and it would compile and run..but it appears differently in OS X.

Anything im doing wrong? my code is below..but i know its rght lol..

#include stdio.h

main()
{
printf("Hello worl/n");
}

D3v1L80Y 03-05-2007 02:28 PM

NOTE: Continuation of previous post. Merged threads

Amen-Moses 03-05-2007 02:29 PM

Quote:

Originally Posted by boletje (Post 341651)
so i downloaded apple developer tools (Xcode 2) and installed it. I made doubly sure i had GCC 3.3 and 4.0 installed aswell as X11 but, i assume the main installer installs these rather then me having to go through every package manually.

I wrote a simple "Hello" program using the text editor "VI" in terminal. But..im a little unsure how to execute. normlly i did "a.out test" and it would compile and run..but it appears differently in OS X.

Anything im doing wrong? my code is below..but i know its rght lol..

#include stdio.h

main()
{
printf("Hello worl/n");
}


a.out is the default name for the executable created by cc after it is compiled and linked.

If your source file is called test.c then try cc test.c

And it probably should be #include "stdio.h"

Oh and you left the d off of "world". ;)

Amen-Moses

(edited to add: Mind you, you really want to use XCode, if you have fully installed it the main XCode executable is in /Developer/Applications.

Google for XCode tutorials as well.)

boletje 03-05-2007 02:34 PM

ok thanks for the quick reply! I just tried what you suggested and its given me two error msgs...

i686-apple-darwin8-gcc-4.0.1: test: no such file or directory
i686-apple-darwin8-gcc-4.0.1: no input files

Opened the file using Xcode...cant build or do anything else other then edit with it. The file is saved in the same location as where ive pointed all the project files to go ... simon/Documents/C_Proj_Files

Amen-Moses 03-05-2007 02:51 PM

Quote:

Originally Posted by boletje (Post 341665)
ok thanks for the quick reply! I just tried what you suggested and its given me two error msgs...

i686-apple-darwin8-gcc-4.0.1: test: no such file or directory
i686-apple-darwin8-gcc-4.0.1: no input files

Opened the file using Xcode...cant build or do anything else other then edit with it. The file is saved in the same location as where ive pointed all the project files to go ... simon/Documents/C_Proj_Files


Have you got the .c on the end?

btw XCode is a full GUI development tool, you really need to read a tutorial on it.

Amen-Moses

boletje 03-05-2007 02:55 PM

yes, the file is called.. "test.c"

Amen-Moses 03-05-2007 03:14 PM

Quote:

Originally Posted by boletje (Post 341685)
yes, the file is called.. "test.c"

Well in that case ...

cc test.c

followed by (assuming no errors) ...

./a.out

Should do the trick if everything is installed correctly.

(Oh and you have to be in the same directory as the test.c file but I assumed that was obvious.)

Amen-Moses

novicew 03-05-2007 03:17 PM

In Terminal
test.c
Quote:

#include <stdio.h>

int main()
{
printf ("Hello World\n");

}
$gcc -o test test.c ---> to create an execution file.

$./test --->to execute

boletje 03-05-2007 03:29 PM

i just get the message from bash that "-o command not found"

UPDATE: seemed to work eventually. i just moved the file from location..replaced it and it seemed to work. TY for help


All times are GMT -4. The time now is 11:11 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.