Cross Platform C++ Tool Chain - c++

Hello I am putting together a tool chain on my windows Box for Cross Platform C++ Development. I plan on using Boost.Build for building and Boost::Test for unit testing. I will be using Mercurial for my VCS because I can just throw the repo on my external HD and then pull it to either my windows or linux partition. The main thing standing in my way is editor compiler/debugger. Anyone have any suggestions?
With Boost.Build I can technically build with whatever compilers it supports easily. That means MSVC on windows and GCC on linux by using the same script with a flag.

Qt Creator using MinGW on Windows and the GNU compiler on Linux. That's what I use and it works perfectly well. Note that you don't have to use Qt when developing with Qt Creator.

May I suggest CMake on Windows and Linux as you can generate native Visual Studio projects as well as Eclipse CDT projects and plain-old makefiles.
If you are targeting multiple platforms, but find yourself primarily developing on a single platform, I highly recommend a continuous build/integration system to ensure a check-in for one platform does not break the build on the others.

Code::Blocks is a free, open source, cross platform C++ IDE. It supports the MS and GCC compilers, among others.

The main thing standing in my way is
editor compiler/debugger. Anyone have
any suggestions?
Yes: Qt Creator as one download and install will satisfy your three requests -- pick the 'LGPL' license route and download and install the SDK which even installs gcc, g++, ... for you. The integrated debugger is very good, and you get cross-platform behavior from both your code and your tools.

you can use gcc/g++ on windows as well. as for debuggers: gdb and ddd might be in cygwin. editor: vim (beware: it's really a programmable editor, not an IDE).

Vim, gdb, gcc/g++, makefile - you can use them on both - Windows and Unix :)
Yet another vote for Code Blocks or Qt Creator.
There are commercial tools too: beside Visual Studio there are MagicC++ (IDE), debuggers like TotalView, Allinea, Zero-bugs, UndoDB ... if you want to stay with VStudio check these VSBridge and WinGDB.
Anyway you can always use MSVC on Windows and other tools on Unix (gdb/DDD for debugging, vim/emacs for edition) - I've worked in this way a lot of years. Common environment for all platforms is nice, but sometimes it is very hard (almost impossible) to "force" it in company (especially big-company) ;-)

Related

Platform for c++ cross compile application

Currently, we are using MS Visual Studio and .NET to develop out applications on Window. We are in the process of porting the application to other OS (Linux, Android...etc) and want to get rid of MS Visual Studio and .NET stuff (they have been a pain to work with).
Is there any good development platform that you would recommend?
Thanks,
ABS
I would port the Visual Studio's solution/project files to CMake (in the downloads list you can get binaries for Windows and Linux), which allows you to generate project files for different platforms, allowing cross-toolset development. Eg:
On Windows, running CMake would detect Visual Studio and would generate solution and project files accordingly.
On Linux: running CMake would find, for instance, gcc or g++ and would generate makefiles accordingly.
I have not tried it, but for android's NDK there's this: android-cmake
[UPDATE Information on gcc/make for windows]
If you want to drop Visual Studio completely, you can try to set up the gcc/make toolchain for Windows with MinGW - Minimalist GNU for Windows, and port your solution/project files to makefiles.
Moving from Windows to other OS'es may shock you at first, but with time you'll get used to it: You do not need a "platform" or "IDE" per se.
What you will need, is cmake, gcc/g++, a decent text editor and perhaps a debugger frontend.
Optionally you may find ctags useful, Doxygen, an svn repo and a profiler (such as Valgrind/KCachegrind).
I am unaware of how exactly you can port .net stuff to C/C++ (other than re-writing from scratch).
Linux and OSX have many similarities, so porting from one to another should not be that hard. Android is a different story, although C++ for android has become a possibility.
The closest thing to what you are looking for, would probably be Eclipse or Netbeans, but again, the simpler you keep those things, the better IMHO.
As to getting rid of .NET, If your .NET code base is not in managed C++ in its entirety, I would try out Mono/Xamarin with Xamarin Studio IDE first before embarking on a full port of .NET code base to standardized C++.

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/

Do I really need Visual Studio

Do I really need Visual studio to build c/C++ application on Windows.
Is there any way to have makefiles and get the application built.
You can use any compiler that'll target Windows (for example, MinGW, Digital Mars, Comeau or others). All of them can be driven by the command line so you can use your preferred make utility (or other build utility).
That said, Visual Studio is pretty nice (even the free version). And don't forget that it installs the command line compiler tools, so you can drive it from a makefile as well (unfortunately, it won't spit out a makefile for you anymore, but it has it's own command line tools to drive a build based on project settings if you want to jump from IDE to command line builds).
If you want to stick to the Microsoft toolchain but don't want the IDE, you can use cl and link to build from the command line in conjuction with either the MSBUILD system or NMAKE.
If you don't have the compiler it is available free with VC++ Express.
To install the Microsoft compiler without installing an IDE download the Windows SDK which is available for free.
http://en.wikipedia.org/wiki/Windows_SDK
Qt is very nice, and downloading and installing the SDK gets you the QtCreator which provides a consistent IDE across platforms, with very nice builtin help, build system, access to revision control, debugging, ... and it even includes the MinGW compiler and toolchain for you.
MinGW is something simpler: the usual GNU toolchain but setup such that it provides native Windows binary.
Last but not least, there is Cygwin which gives you the most Unixy flavour.
No, you don't.
I know you said c, but you can also check out MonoDevelop, should you choose to do more than just that: http://monodevelop.com/Download
No you do not. There are many free IDE's out there, or you can do everything from the command line with a non-microsoft compiler.
www.bloodshed.net offers a pretty good IDE that uses the Mingw compiler.
You can even do without extra tools as long as you have the compilers on your machine. Take a look here for an explainatin:
http://msdn.microsoft.com/en-us/library/ms235639.aspx
Not at all. It is quite possible to do Win32 programing, including OS and GUI programming, with gcc from Mingw.
For all my hobby work, if I can I use the gcc compiler from Mingw (for C or Ada), with Emacs as my IDE and gnumake for my build system. There are good Mingw ports for all the major revision control systems too, including Git.
That's the toolset I used to create the SETI#Home Service, which was a wrapper for the SETI#Home client that installed and ran it as a Windows service, did failure detection and auto restarts, and had a built in web server for monitoring. All that with no VisualStudio.
You can use Eclipse with C/C++ Development Toolkit and with Mingw Compilers. the only problem is that you will not have M$ Stuff like MFC, but you can use QT or wxWindows
Two solutions that immediately come to mind:
Cygwin
MinGW
Using makefiles does not prevent you from using the Microsoft C++ compiler, which is nice if you want to use the VS debugger.

Ubuntu desktop development environment (GNU tools)

I am setting up a Linux development machine (Ubuntu 9.0.x).
I want to know the best development environment for a C++ developer on Ubuntu - giving my background (see below).
5 years+ C++
5 years Visual Studio
Not much experience using GNU tools (GCC, GDB, make, etc.)
6 months or so of using Emacs at university (about 8 years ago!) - I don't remember anything though ;)
I come from a Windows background so am more at ease with GUI than CLI, although I expect to learn the CLI commands over time. I want to be effective and "hit the ground running" as it were, in terms of developing on Linux.
I am particular interested in tools that will make my life easier for:
1). project management
2). build configuration via GUI (rather than makefile editing - at least for now).
3). debugging IDE that allows me to set breakpoints and step in/out/over
It would be useful if the IDE suggested has a GUI to ease my transition to Linux, but is also customisable (e.g. can accept hand crafted edited make files etc. - when I have learnt how to create them). This will allow me to have more control over the build process later on.
Which set of tools would you recommend in order for me to achieve the maximum productivity in the minimum amount of time on my Ubuntu desktop?
So:
Which application (IDE) offers:
(i). easiest transition from Visual Studio (and ideally can use manully crafted make files)
(ii). extensive debugging capability akin to Visual Studio
for the latest Ubuntu (9.0.x) desktop OS?
As for C++ developing I'd choose Qt Creator IDE for easiest migrating from Visual Studio. I believe it can cover all your needs.
The best tools that you need are:
make
gcc
g++
Your Favorite Text Editor
auto-tools
Qt Creator
Glade
Your Favorite Project Manager
For Ubuntu I suggest you to use Glade, because Ubuntu uses Gnome(GTK).
About IDEs:
Eclipse For C/C++
Netbeans For C/C++
Code::Blocks
Kdevelop
I think you should just bite the bullet and learn enough make, gcc, and gdb to accomplish what you need to do at the command line. If you get that taken care of, you can use whatever editor you like to write the code -- even Visual Studio's editor.
Have a look at Code::Blocks. It's a nice IDE for doing C/C++ and comes with an own build-system. But be sure not to grab the version inside the official ubuntu repository but go to the CB forum and look for the latest nightly build. There are people maintaining repositories with ubuntu packages. I think CB is worth the hassle of installing the latest version.
Link to Code::Blocks Forum
Btw. I did an install some days ago. There are two people maintaining 64-Bit Ubuntu packages. Only one did work, though. It was this one.
You can use Glade Interface designer (glade.gnome.org) for interface design.
BOUML for UML modelling & project management
You can always use eclipse or netbeans for c++ development on linux.
Though I recommend Eclipse, it would automatically generate makefiles, debugging is very easy & you can configure your code repositories within the IDE.

C++ development for Linux on Windows

I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.