Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this questionI have till now mainly concentrated on web programming thus far and now want to enter application programming space. I use a mac, and wanted to know what sort of compilers, IDEs etc people generally use for c++ dev.
extremely n00b
One more thing immensely bothering me was the fact that c++ compilers generally output .exe
which can't be used on macs. I need to understand basic OOP programming fundamentals and thought c++ would be the best choice. Please suggest something.
Compiling C++ on a certain operating system (OS) will create an executable file for that OS. You are not limited to only a .exe binary file.
The first step to start creating your first C++ application is to install Xcode. This development program is not installed by default with Mac OS X. You must insert one of the DVDs that came with your computer and install it. After, start Xcode and click on File and then New Project. Once that is done, select Command Line Tool and make sure that C++ stdc++ is the selected type. Before I forget to write this, Xcode's compiler for C++ is gcc. If you need some help to start off you always visits some sites or buy (or rent) some books.
One thing to note is that Apple's main programming language is Objective-C which is different from C/C++. While both of these languages have common features, it might be easier to start with Objective-C. It is possible to do some OOP with Objective-C and it will be easier with it. On the other hand, it is possible to do more complex OOP with C++ than with Objective-C.
If you ever wish to learn the basics of the Cocoa Framework (which is a set of libraries and tools to help you create a window), I suggest you learn how to program (some Objective-C or C++ could be nice) and buy the book Cocoa Programming for Mac OS X from Aaron Hillegass.
If your question really is: can I use C++ to develop Mac applications, then the answer is yes, but for true native Mac applications you probably want to invest in learning Objective-C and the Cocoa frameworks.
A c++ compiler will output object code that should be native to the platform the compiler is built for. So on a mac it will output executable programs that will work on a mac, not windows executables.
XCode is a well regarded mac IDE that you can use for C++ development.
Java may be an easier choice for OOP as it avoids many pitfalls that can catch out novices. Another OOP alternative is Objective-C which is a good choice for mac development.
You also can use QT Creator which is a really nice IDE :)
Just use xcode / gcc to create and compile C++ applications on your mac. Native Mac applications are most commonly coded in objective-C, but since the mac is a variant of bsd, using gcc tools to create a c++ executable is also common.
edit: to clarify: - xcode is the free Mac IDE that comes on the install disk - gcc is the open source compiler. it is part of Xcode.
If you are using a Mac Xcode
is the way to go, there are of cause others out there, like Net Beans
and Eclipse
Comparison of integrated development environments - C/C++ http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#C.2FC.2B.2B
I use Code::Blocks with gcc and a GNU toolchain for embedded development on a Mac.
If you are intended to build applications for MAC then best way is to learn "Objective C" and use Xcode editor on MAC. This will help you in long term as well. Xcode also allows you to build application using C/C++ and java, along with objective C.
A good way to start can be visiting this URL http://developer.apple.com/mac/, It has help also avail.
C++ is not restricted to .exe files.... window PE files are one container format for machine code. A C++ binary can be encased in any low-level container format you can think of.
Objective-C on the mac can be a very pleasant language to learn, also Java. Do you really need to learn C++ at this junction ? C++ is suited to low-level programming problems -- i.e., video games, system software, and generally performance-critical software (photoshop and imovie).
精彩评论