Yes you read the title right! We all know Mac and Xcode are made for each other, They are just like Romeo and Juliet 😜 and Xcode works magically for iOS/MacOS development with Objective C or Swift(❤️) but what we dont know is Xcode works great for c,c++ as well.
Usually first hand advice we get is to use some other IDE and there are tons of them and they all work great. If you are using them and happy then this post wont make sense for you but if you want to do everything using a single IDE like me than you should give Xcode a chance.
I always loved c++ but never used it a lot other than for writing short small programs, since I am in my final year and we have companies coming in for placements, I have to practice c++. I started with command line but as you get into more complicated code which require you to debug it again and again it gets a bit rigrous.
For someone who loves Command line you can directly use this to compile and run a c++ program where helloWorld.cpp is the file name and helloWorld is the output file.
gcc -o helloWorld.cpp helloWorld
./helloWorld
Here how you can start with Xcode for C++ :
Xcode > File > New > Project > macOS > Command Line Tool > Next > Language -> C++ > Next
just like that you have the project up and running which will run your C++ program. You can also choose C,Swift or Objective C.
As you can see, the above image shows that you can simply run the program : main.cpp is the file which will run the main function first. The bottom right panel works as a terminal which will show you the output and you can take input from the same too.
This is just the Beginning of how to run a simple program. As I am also learning more and more of Xcode and C++, In the next few medium posts I will be talking about how you can add Multiple files, Multiple targets in a single project to keep all your code in a single place. Renaming the main.cpp file to something else. File handling and breakpoints(Basics). Command line arguments(I am working on this and will figure this out).
I wrote about adding Multiple files/Multiple Targets here :
I wrote about File Handling here :
Note : I am also learning, there can be chances where there will be a better way to do things. If you know about it please let me know so we can all learn :)
Also I am falling more in more love with C and C++, if you know something or can direct me to how one can use C++ to write something more than a program that would be awesome.
I am A”Viral” - WWDC17 Student Scholar, a Tech Enthusiast,A beginner in entrepreneurship, innovator and a prototyper.
I am A”Viral” - WWDC17 Student Scholar, a Tech Enthusiast,A beginner in entrepreneurship, innovator and a prototyper.
This is my story of how I got the Student Scholar Award and my experiences through out the Dub Dub Week and some advices for anyone going in next coming year.
If someone says Dreams don’t really come true then I can prove they do come true.
Getting a Scholarship is tough but one should keep trying. I was rejected for WWDC15 and WWDC16 and now I know why I was rejected. Learn from mistakes. Apple likes good and innovative projects which are simple, addictive and have a purpose and most important they should be good looking.
This year half…
Post a quick thought or a long story. It's easy and free.
MXNet is pretty famous and have tons of good articles already there to start with but I faced some issues initally as MXNet works with Python 3 on macOS and macOS comes with Python 2.7.
This is a good article to read about MXNet and checkout the Official install page.
Noting the commands one should use to install MXNet on macOS are :
Install Homebrew :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Install Python3 using Homebrew (make sure to use python3)
$ brew install python3
Now Install all the Packages. Make sure to use pip3 instead of…
I always ask this question to myself, “Am I the smartest person?”, “Am I really good at my work?” It is good to be positive about yourself but the answer to this according to me should be somehow a “NO”… Once a person starts to feel that he is very good at what he does, or he is really smart, the person somehow starts losing the motivation to learn new things, his attitude changes and the spirit of learning from other people around him starts depleting. …
We all love what we are working on and somehow we stop discussing the idea with other because of the fear that they will take our idea and make a billion dollar fortune. We fear if they don't like our project. We fear what if they will make fun of us. We fear to talk about our own ideas. We fear about others what image they will portray after listening to our ideas and a lot of other reasons because of which we stop discussing our own ideas and somehow stop improving our idea and end up making a product…
We “Geeks” usually get a lot of ideas while looking around different websites and mobile applications and Bam! we think of an idea and we get excited about it.. we guys usually think about it for a couple of days and then discuss that with our friends and then sometimes Shit Happens! your friends says it will not work he/she shows you different apps or websites which are close to your ideas and then you leave that idea but No! we should test each idea if we can manage to pull off it in our free time!
Yes the point…