Have macbook... What compiler can I get?

+1 Cate Peterson · July 15, 2014
I have a macbook and want to run the C code I learned from Bucky's videos .

I downloaded Sublime Text. It says I have 2 errors. (Itâ??s also not free and wants me to pay $70.) IT says this: "clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated.â??, which likely means I have wrong compiler, right?

What complier can / should I get? And how, would be helpful. Or how do I use on a mac?

Post a Reply

Replies

Oldest  Newest  Rating
+1 Cate Peterson · July 16, 2014
Mathias: Thank you for the debug help. I did change to if and else if, but I will try learn switch later. I just never got the code compiled at all until I learned the below. Hope it can help other mac users. I still have to practice with the \n placement. My program ran and I was able to debug (with your generous guidance) once I answered the question I posed. I guess my whole problem was with the compiler and terminal process on a mac, which seems less intuitive than on a PC and doesn't have that separate execute/run screen like shown on videos! 
THE ANSWER WAS:

To Compile:
Click on the magnifying glass symbol in upper right corner of screen.
Type in terminal and click it.
In the terminal window that opens type gcc then type a space (this space maks a difference: no space-no run) 
Drag file (or enter location name) then type a space
Type -o then type a space
Type filename (you choose a file name of course)
Hit enter. (That compiles it, tells you lines to debug if needed.)
To Run:
In same window type ./filename (of course use the name of the file you choose above.


I want to learn "A" programming language well, but probably not C. I merely wanted to test waters before moving on. What language should I invest my time in?
0 Ashish Ahuja · July 19, 2014
In the videos, Dev C++ compiler has been used to compile and run the code while allows you that clicking a run button functionality. And as far as learning a language is concerned, it depends on what you are thinking to do. There are a lot of things you can get into like web development, software development, mobile phone apps development.

Web as well few mobile applications and software too these days are widely using languages including HTML, CSS, and Javascript.
As far as programming is concerned there are options like Java, C# for both desktop applications as well as mobile phones development etc.
Its better to research on few of the languages and then reach back for any more queries :)
0 Arend Peter Castelein · July 21, 2014
Like fructose and lama said. People you see in videos are using IDEs. IDEs are programs which include both the text editor and compiler. Compiling in terminal is different. Compiling in terminal should just be using a compile and run command. You've included opening terminal in your compiling steps but you really only need to open it once per development session and you can leave it open for the whole time.

As Mathias said it's easiest to be in the same directory as the file that you're compiling/running, this way you can refer to the file only by the filename instead of the full directory. When you'r dragging the file into terminal I believe that's copying over the full directory name.

Here's a video I found explaining how to navigate terminal.
https://www.youtube.com/watch?v=Vhcx4KJbtes

As for which programming language you should learn. In my opinion it doesn't matter much at least for starting out. Most programming languages share the same core scripting aspects (if statements, for loops, variable creation, etc.). You can learn the language then use projecteuler.net to practice you're logic skill. The process of learning your first language can give you a better idea of what area you want to specialize in, and the logic skills from your first language can be applied to any area you go in. 

I'd probably recommend starting with a language that's a little easier to learn to start with. C and C++ have pointers and memory allocation which makes them a little trickier. Java and C# are a little easier and Python, Visual Basic and Javascript are easier yet. 
0 Cate Peterson · July 15, 2014
I just want the thing to run once...then I plan to move onto a new language. I thought the 15 bite size tutorials would be quick way to do it in a a couple days... not sure I want to invest time to do Harvard's CS50 course. 

I used Sublime Text 2.0 this time (instead of the 3 version). This time it said:
clang: error: no input files
[Finished in 0.1s with exit code 1]

I even took out the #include <conio.h>; line. I guess I just don't know how to work the compiler program. I think the code is correct.</conio.h>

Anyone use Sublime Text 2.0 on a macbook?
0 Cate Peterson · July 16, 2014
Do I still have to open terminal and type gcc and drag file?

All the videos just show clicking some sort of compile & run button and window for io opening by itself. 

Want a new career.
I've got about 4-6 more years of kids in school, then I want to do something different.
I am adaptable. What languages would be in demand for paying jobs in the future?
-3 Ashish Ahuja · July 21, 2014
Dev C++'s compiler. It was a typo :angel:
  • 1

C

124,414 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator