I'm starting my C++ learning, using CodeBlocks and windows, what compiler should I use? - c++

I'm under the impression certain compilers only work for making windows applications.

If you want to develop GUI applications and/or go for maximum portability, go for MinGW for compiler, and Qt Creator for IDE (it comes with MinGW bundled).
If you want to stick to Windows, and don't mind coding UI directly using Win32 API, then Visual C++ Express would do the trick.

If you care about portability to Unix, use the mingw compilers which are based on gcc. Gcc is widely available on a lot of architectures and OS. If you only work for Windows, Visual Studio Express might be a better choice in comparison to Codeblocks.

How about Visual Studio Express? This is a complete package with a very nice IDE.

Codeblocks supports many compilers. I recommend using CB with mingw for general purpose usage.

Depends what you want to do. If you want to use POSIX APIs you may want to use mingw. If you distribute to Windows folks, you probably want to use Visual Studio since its compiler is usually better at producing optimized code.
CMake might be something you want to use if you want multiple platforms - it'll create your CodeBlocks/Eclipse/Visual Studio/GNU Make projects for you w/ all the correct settings.

If you are keen on using Codeblocks mingw is a good choice. But C++ is not like Java. It is not write once run everywhere. Also it is not write once compile on different platforms and run everywhere.
You have to change your code for different platforms (win/unix etc...) (eg: socket programming differs on Windows and Linux)
This means that you are not platform independent. So I recommend you to go for a better one. Eclipse is good, community is great but for me QT or Visual Studio (6.0 or 2008 for .Net) would be better.

Related

Best alternative for Visual C++? VS11 Express can't be used to write desktop apps

Some of you might already know that Microsoft is trying to kill desktop development in favor of Metro style apps. The express editions of the new Visual Studio 11 will only support writing Metro style apps. They also won't give you the new compilers as part of the new Windows SDK. The only way to get the compilers is to buy Visual Studio Professional or higher.
Now it's time to find an alternative (alternative compilers for the Windows platform). Any suggestions?
Some links that are related to this issue:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2645679-visual-studio-11-express-on-windows-7-and-the-abil
http://blogs.msdn.com/b/visualstudio/archive/2012/05/18/a-look-ahead-at-the-visual-studio-11-product-lineup-and-platform-support.aspx
http://www.microsoft.com/visualstudio/11/en-us/products/express
Gcc/G++ of course. In my opinion it is superior to VC++. In addition, you can use Eclipse CDT as IDE, it is quite usable at the moment (compared to older versions). I work like that on Windows. In addition, you can also work on Linux or MacOS without having to switch to another tool.
1) The Metro and WinRT features are accessible from C++/CX which in turn is built on top of COM, so according to this detailed discussion (SO question on WinRT and C) you can use the latest "Microsoft-only" features with any decent C compiler. Of couse this will require some code generation or just a lot of typing to get the access to basic facilities. I believe there would be a transition period and then the open-source community comes up with some automated solution to consume the WinRT APIs.
2) A quick list of available options right now.
Dev tools: MinGW or Cygwin (GCC toolchain + unix-like tools), Clang maybe, OpenWatcom as a thing from the past
GUI Libraries: FLTK, Qt, wxWidgets, Fox GUI toolkit, librocket (if you are into the OpenGL world)
IDEs: Code::Blocks, Eclipse+CDT, QtCreator
3) There's also a non-C++ way:
The FreePascal+Lazarus to allow Delphi-like RAD
Mono/SharpDevelop
Both options can use C++ code with some bindings.
4) Conclusions
These are the alternatives which give similar results but not always the similar level of comfort.
Yet another possibility would be Qt Creator, which comes with a full toolset targeting Windows (as well as MacOS, Linux, and Symbian). It is definitely somewhat different from VS, so it takes some getting used to, but overall I'd rate it as pretty decent. Qt (the library) generates somewhat mixed feelings -- some dislike its oddities (E.g., MOC), but quite a few consider it the best designed GUI toolkit available.
Don't forget the Netbeans GUI which is also available for windoze. It works great, just install mingw and choose this mingw/bin directory for the compiler tools and mysys/bin/make.exe as the make program
to download
https://netbeans.org/downloads/index.html
they have this plugin for vc++
http://plugins.netbeans.org/plugin/42519/vcc4n-visual-c-compiler-for-netbeans
some install info
https://netbeans.org/community/magazine/html/03/c++/
Another IDE that I havent used but looks good is
http://www.codeblocks.org/

Linux app using C++ and visual studio

I want to write an app in visual studio that will work in linux. It's main function will be to monitor multiple linux systems and provide health and status to the GUI... I.e disk usage, bad drives, network throughput, mysql reads/inserts, ect... Can I cross compile with visual studio 2010?
Should I even bother using visual studio? Or should I bail and use Java or C++ on linux?
Thanks for the help guys, looks like the inevitable is true! I was just looking at netbeans, so I guess I will use that. I don't normally write for Linux, so I will just have to plow through it :)
Thanks
If you like the VS IDE, you can certainly use it to write code that's portable to Linux, though actually compiling the code for Linux will be separate. In theory, you could probably configure VS to compile your code with gcc as a post-build step, for example, but it would probably be more work than it was worth.
At least IMO, if you're trying write code that's portable to Windows and Linux (e.g., using Qt for its UI), and you're comfortable with VS, it's probably worth using VS to do most of the work. If you prefer Linux tools or you're writing the code exclusively for Linux, then you're probably better off using Linux tools throughout.
No; Microsoft Visual Studio does not contain a cross compiler for Linux. Nothing says you cannot use the C++ you build in Visual Studio on Linux machines though; you would just need to compile to code there.
As Visual Studio does neither run on Linux natively nor can it produce native Linux code, I would recommend you use the target platform's native toolchain to build your software.
If your goal is to create a portable application that runs on both Windows and Linux, starting one Windows with Visual Studio and recompiling the code on the Linux system on a regular basis is probably a pretty decent approach.
It is possible to use Visual Studio to develop, but you can't create the Linux executable with it - for that you need to use the gcc compiler under Linux. You'll find a few differences between the compilers that will give you some grief, and unfortunately a lot of those differences will be in the areas you're targeting - O/S services. It's a judgement call which would be easier but in your case I'd bite the bullet and use the Linux tools exclusively.
Bail.
Maybe look into monodevelop which is much less nice than Visual Studio.
Netbeans and/or Eclipse for linux are nice though.
Bail, Visual Studio is definitively not the best tool for this particular job.
If you want to code C++ for GNU/Linux, there are a lot of good IDEs in there: Eclipse, NetBeans, KDevelop, Codeblocks...
Also, check the answers on this question: C++ IDE for Linux?, I think you'll find some useful stuff there.
For what it's worth I've used VS to write code that was supposed to work on Windows and *nix. I'd figure out a configuration method for *nix and as you go before every major commit try compiling the code with gcc. Visual Studio's Intellisense and VC++ debugger murder Eclipse+CDT+gdb in every way.
I'm fairly partial to Qt Creator for my x-platform C++ tasks.

Which IDE for C++ software can I use for targeting Windows, Linux and OSX?

I was reading today question on IDEs fo C++, and there are very good ones like Netbeans.
My question is about creating a software in C++ on Windows Environment, but let users install and run my software also on Linux and OSX.
Does netbeans has a compiler to do the job, or is there any good IDE which has a compiler for targeting my c++ code to these other environments?
thank you
QtCreator. It's awesome, slick and everything.
While it is not as feature rich as some competitors, it does many things just right that others don't.
I would say it is the one truly cross-platform IDE that is competitive to single-platform solutions. And it comes with tight integration of a very powerful and clean cross-platform toolkit. Something that you need for most cross-platform applications by itself.
I use Eclipse CDT and have had some degree of success. But I'm a Java programmer, so it's what I'm used to. It's worth checking out, and the extensions are quite cool.
Many people like Code::Blocks and it is cross-platform, with integrated debugging, code completion, etc. Qt Creator is also good and at least still very minimalistic.
Without a doubt VisualStudio with gnu make.
I've found Visual Studio to have the best IDE for C++. In addition, it's debugger and the way it handles multi-threaded applications is excellent.
And you can tweak the properties for your project to use different compilers and compiler flags of your choice, so it can build to any target.
You're talking about cross-compiling as GMan said, that's a compiler job, not IDE's and itu's kind of hard to make C++ software that runs well on Linux/Windows/MacOSX, C++ isn't a cross plataform language beacuse of its ABI, so you should try to use C++ standart code.
If you're making a consloe application there's no much problem just be care not to use system interface, but if you're planning to do some kind of graphics app then C++ it not the better choice for your purpose. Try some design that split the view from the controller/model of the app.
You can use QtCreator or NetBeans. First on C++ secord on Java. Both use MinGW g++.
Just a thought: you don't need to use a single IDE for all platforms. It is very common, for example, to use Visual Studio on Windows and Xcode on Mac OS X for cross-platform projects. I'm not familiar with Linux IDEs thought so couldn't recommend anything there.
Write makefiles for each OS? Simple enough seems to me.
Concerning cross plattform development it doesn't make a difference which IDE you use. Just make sure you use a cross platform (and possibly IDE independent) build system like SCons or cmake.

Setting up windows for C++

To quote the FAQ, 'No question is [...] too "newbie"'
What is the best way to set up an Windows system (vista, if that matters) to work with C++?
Preferably with a nice IDE, easy compiling of software (support for make files, etc.), but suitable for a beginner.
I would quite like the IDE to use a relatively portable format, such as makefiles and configure scripts, nothing too proprietary.
I would also like the ability to add new libraries etc. without much hassle, and work with the majority of C++ code others have written.
I am comfortable using the command line.
Thanks for the help, hopefully the question is clear. And apologies if it's already been answered, i did have a look for similar questions.
I know this is not exactly 'nothing to proprietary' but you should give a look at the free Express Edition of Visual C++. Under its covers you'll get all the familiar make and command line tools, but wrapped in a polished IDE.
If you're really comfortable with the command line then you can make an IDE from code editor on top of a compiler/debugger suite. MS's own command line tools come with the platform SDK (free) and you get an awesome debugger in Windbg. My personal favorite code editor is Code Insight. I wish so hard for a Mac version /sigh.
Microsoft's Visual Studio has a free express edition which contains pretty much everything you need to program c++.
For a Gui, the main choices are probably, MFC (old and ugly), CLR/.Net (new and confusing) or look at Qt(now LGPL) or wxWigets
There are quite a few good IDEs for C++ available on Windows.
The de-facto standard for professional software development is Microsoft's Visual Studio, which is available in different versions, like the free Express Editions. This will give you a great tool-chain for Windows development.
However, for a more "cross-platform" approach, you should have a look to the free Eclipse C++ Development Tooling, which is available for many platforms. As long as your own code is platform-independent, the whole project can be shared between Windows, Linux, Mac, etc.
Other alternatives are MinGW or CygWin that both allow to use the GCC toolchain on Windows.
Try the MinGW compiler, it will come with a C and C++ compiler, Make, etc--among many others. This can be used from the command line, pretty easily: g++ -o someprogram.exe somecode.cpp
As for an IDE, there are lots out there. Right now I am using Code::Blocks, and so far it's been really nice. As well, it already supports the GCC compiler, and sets many of the appropriate flags for you, so all you'll really need to do is hit the "build" button.
Some others you might want to try are Eclipse, which is really powerful, but lots of its "power" will be really confusing and difficult to use until you start getting used to it. Visual C++ is another one, which (obviously) would integrate very nicely into Windows. Of course, you could always use emacs :)
I suggest you evaluate CodeBlocks.
Microsoft's Visual Studio is powerful but rather proprietary. If you prefer open/portable stuff, I recommend Dev-C++ and Cygwin.
FWIW, I recently went through this and tried the VC++ Express and QT Creator based stuff. Coming from a linux/unix background I found that QT was a little better since it was using the Ming compilers and some make based constructs.
If you will only be hacking for windows I would go for Visual Studio. It will definitely save you time you can spend on coding instead. Most open source out there for windows either already have VC project, and if they don't it is usually very simple to set one up. And normally they have either make or nmake files for you to build VC compatible libararies to link with.

Need a c++ compiler to work with libraries (boost, ...)

Currently I`m using Visual Studio for writing code in C++. But it seems so weighty that I decided to switch for another one, preferably free, not so strict to system resources (I mean memory, of course) as VS to learn libraries, such as Boost and Qt. What compiler do you suggest?
I'd suggest using Visual Studio's compiler from the command-line. You get the same high-quality compiler, without the resource-hogging IDE.
Although the IDE is pretty good too, and probably worth the resources it uses.
Code::blocks is exactly what you are after. You can can download it here: http://www.codeblocks.org/downloads/5
Choose the version with the mingw compiler bundled with it (Windows port of GCC). You can switch between that and the VC++ compiler as and when you like.
Code::Blocks has all the stuff you want, debugger integration, code completion, class browser, todo list etc. etc. It even import visual C++ projects.
Don't use Dev C++ which has already been recommended. It's very very old and outdated.
If you want to learn unix tools download and install cygwin It's a good set of tools but a full install takes up 5 or 6 gigs because so much is included.
There is always Digital Mars. Also, you can freely download Microsoft WDK
which comes with their C/C++ compiler and command-line build system.
You will be hard-pressed to find an IDE as capable as MS VS. It is incredibly feature-rich.
However, if you just want command line compiling and linking it can do that too.
GCC is also an option.
Please note that you do not need another compiler or IDE to use boost libraries. I wouldn't replace Visual Studio with any other IDE/compiler, at least not on Windows. Installing Cygwin or SUA (better than Cygwin, closer to the Windows Kernel) will only be a pain just for what you are trying to reach.
Try to minimize the memory usage by disabling unnecessary things, keep the amount of open source files small, use an alternative to document explorer to find help (your browser on msdn will do). Besides that, I wouldn't call a few ten megabytes of memory a high usage. As long as it doesn't slow your system down there is not a real issue.
A better idea would be to upgrade your computer rather than to replace something powerful with something that you don't know.
Seriously there is no real alternative to Ms's compiler on Windows. All the others are OK if you can't spring for Visual Studio or if you are just doing hobbyist work. Cygwin can be a pain to deal with.
If you don't want the IDE as someone else suggested just use the command-line compiler.
I've found VS to be quite good for doing Boost + Qt work. Especially if you have the Qt + VS integration tool. You get a GUI designer and respectable Qt project management tools.
If you are looking for a compiler that uses fewer system resources than the MS ones, you'll probably find that most modern compilers that are able to compile a good part of or almost everything in Boost will be quite heavy on system resources, both processor usage and memory consumption. To a certain extent that's just par for the course when it comes to C++.
That said, I do like to have a second compiler around if I'm writing portable code as it's a lot easier to iron out portability issues when you can ensure that the code compiles in different environments. If you want to do all that on Windows, may Cygwin is worth a look. However it does seem that the GCC you get with Cygwin is not exactly what you'd call up to date.
The aforementioned Digital Mars compilers are well worth a look, Walter Bright (the guy behind them) has been writing C++ compilers for a long time and they're pretty good. I have used them off and on since the early nineties and I've always been happy with them. Not to mention that they always seemed noticeably faster than the Microsoft offerings, but I haven't got any recent measurements to back that up.
At the end of the day, most third-party tool vendors on Windows tend to target the MS environment so if you're writing C++ code professionally and need/want tools like leak detectors, you pretty much need to be able to build with the MS compilers, even if they aren't your main development environment.
I sugget , Netbeans.org
NetBeans IDE , download the Cygwin , follow one tutorial from http://www.netbeans.org for C++ confuguration at Netbeans IDE , just 2 steps.. and u are ok
autocomplete (faster than VS')
classes
and all... you want xD
It needs to mention about DevCpp. It is a simple UI wrap for gcc compiler (oh my, it is sounds like a tautology). It provides lightweight IDE but not so stable (so, its IntelliSense is somewhat buggy).
If you use Qt why not use their IDE, QtCreator, there is compiler, debugger and GUI designer. All comes in one nice package and works on Windows, Mac and Linux.
In my opinion it's better than Code::Blocks (also based on MinGW/GCC).