How to organize Windows and Android builds of my C++ game? - c++

I would like to develop a Windows build of my Android game for testing and demo purposes. Most of my code is C++, using OpenGL to render, with a thin Android/Java layer that forwards touch events and loads resources.
My first thought was to make a Visual Studio project for my Windows version, as I'm familiar with it and the debugger is excellent.
Can I get similar C++ debugging functionality with Eclipse & CDT? It seems tidier to have all versions working from the same IDE, and it would be nice to become less dependant on proprietary software. Would I be able to add a Windows build configuration in CDT, switch over, and have the IDE launch & debug my Windows version instead? Or would I be entering a world of pain setting this up?
Are there any other approaches I haven't considered? All advice welcome!

CDT is a perfectly good Windows development environment. Just make sure that you have installed the Windows SDK.
If the concern is that Visual Studio puts a lot of the Windows-specific code in place for you, you might consider starting a new project in it. I'd avoid MFC. Just create a new Win32 project. Then, you could take that code and use it as the basis for your Eclipse project, folding in the platform-independent code from your original Android game.

You can easily come up with a cross-IDE solution using makefiles. I guess cmake could help you here.

You could try out MPC. It can generate VS solutions or Eclipse CDT projects(and some more). I've been using it at my previous job and it's really neat once you get the hang of it(which shouldn't be very hard). I'm not sure how well does it work in a
cross-compilation environment, as we were using it to build our project on PC for Linux/Windows.

There's no reason why you shouldn't be able to use Eclipse on WIndows as well.
As far as I know though (I haven't used Eclipse for C++ that much), Visual Studio still has the best debugger. (it can also be a good code health check to compile it with more than one compiler). So there may be reasons to go with VS as well.
If you do decide to go with VS for the Windows version, you may want to look into CMake for managing the build system, since it can generate Visual Studio solutions as well as makefiles and pretty much anything else you may need to build.

Related

What should I use for coding C++ on a Mac and Windows?

A group of students and I are making a C++ game, but they have Windows and I have a Mac is there something we can use to share code between the systems?
I know Eclipse will work but I get Unresolved conclusion: <iostream> as an error. If anyone can help with that it would be great.
If you want something to actually "share the code" with, I would recommend git using github as the remote location. Its free and easy to use.
If your question is about the code not working, make sure you have X11 configured properly, and have the Eclipse C++ plugin installed.
And I would also recommend using XCode as your editor instead of Eclipse. It has a much better environment for C++, IMHO.
Hope this helps.
Personally I'd recommend setting up a cross-platform build process using something like CMake (http://www.cmake.org). CMake in particular will generate platform-specific project files for you -- so your friends could be working in Visual Studio and you could be working in Eclipse or XCode, with no problems at all (of course, you'd have to write portable code... :))
As far as sharing code and version control goes, I agree with Jon that something like git is ideal.
We build our Windows+Mac+Linux apps using Qt, which includes a nice build system (qmake) and cross-platform APIs (so the same code will run on all OS's) and an IDE (which I haven't used but I hear is okay).
With multiple developers you'll definitely want some sort of source-code-management system as well, git and svn are both good choices there.

Should I cross-develop for Linux under Visual Studio

It seems that Visual Studio and the tools you can use it is far superior to Eclipse and other Linux-platforms.
So does it make sense to cross-develop for Linux under Visual Studio, as long as the code is much the same?
I assume that you can easily share files.
Of course it depends a lot of what you know and project setup, but for the later, importing to VS might be easier than importing into Eclipse.
This is actually possible, but only if you have the right infrastructure in place on both Windows and Linux (or some other *nix variety). I used to worke for an investment bank where almost all work was done on Windows with VC++ and then moved to Solaris and recompiled. This allowed us to use the far superior (over Solaris) Windows tools. And we are talking of building multi-tier, multi-threaded servers here.
However, in order to get this to work they had put in a massive effort (I would guess about 15 man-years) in terms of senior developer time. And it was kind of worth it because Solaris development tools are pants (but the Linux ones are actually quite good). It's not something you, as an individual developer are going to find particularly easy to do, unless you are writing generic command line utilities. In which case you can do it - I routinely recompile my Windows command-line projects on Linux.
The difficult part, in my opinion, is maintaining the separate build systems. If you start the project using Visual Studio you will be tempted to setup the project using the Visual Studio build system.
Don't do that.
Instead, I recommend trying CMake. Make the build system build using CMake, and then work from that starting point.
If I had to choose between Visual Studio and Emacs, I'd go with Emacs. The fact that Visual Studio seems superior to you is just because you got used to it and don't know how to do your usual workflow using other tools. Eclipse, after all, might not be the best choice for Windows developer to move to Linux. I'd also take a look at Qt Creator.

Is there an open source for free tool for MS Visual C++ Express to build using gcc?

While the Microsoft compiler typically builds faster code, I'm in an environment where building Linux applications with gcc is required. I prefer MSVS and the Express versions as my IDE and have been able to configure it such that Intellisense and all the other nice features are working. However, I have been unable to find an easy way to get VC++ Express 2010 to build using gcc. I'm not sure if I remember correctly, but I thought about half a decade ago there was support to switch compilers when using MSVS.
I have found an extension to download claiming to do this, but it costs about $50. Does anybody know of any free or open source tools that can accomplish the above?
Try CMake: http://www.cmake.org/. It is a cross-platform, cross-ide build system. It will generate
VS project for you, and ordinary makefiles (or eclipse, or what you need).
Then, use VS to edit the code, and "make" to build it. I did it myself to develop windows + linux on virtual machine. And it worked fine.
As I realize there are no plugins, but you could simply setup some custom build rules and make gcc compile your project instead of the cl.
Google for the Custom build rules in Visual Studio / provide your own makefile. Also note that if you wish to still have the ability to debug your applications, you should probably look for something like WinGDB.
The good thing in this approach is that you can switch your configurations from cl to gcc, for example and easily test if your application remains compilable in both of them.
Still, the best way would probably be to use some automatic building tools like cmake or scons, which simplify the process greatly and can help you to switch to any other IDE in a matter of minutes.
Personally I like scons, because it's python-driven, but cmake is very nice to start from.

Good C++ Debugging/IDE Environment for Linux?

I have a friend who is trying to make the switch to Linux, but is hung up on the apparent lack of debugging/IDE environments for C++, especially as they relate to template programming. He has been using visual studio for years and is maybe a little spoiled by their awesome IDE. Does anyone have any good suggestions for an environment where he can, under Linux, develop and debug with all of the usual things (Breakpoints, line highlighting for compilation errors, step in/over/out/etc, etc) that he's accustomed to? Thanks!
How about Eclipse + CDT ?
Although many people think of it as a Java IDE, he could try NetBeans. I've used it on Windows for C and C++ development without a problem, and I know NetBeans is supported on Linux, so it would be worth a shot.
It looks like most of the features he wants are included in the C/C++ development toolkit, including integration with GDB, a profiler, and more.
Visual Studio is good, indeed.
On the free side:
Qt Creator is getting quite good too, it's worth a try. There are advantageous by-products coming from the Qt framework:
huge library - not only to build GUI applications but for other domains as well
portability on multiple platforms
A version 1.3 beta is available as a preview of the upcoming release but the current 1.2.1 is already all you need to manage projects.
Eclipse has already been mentioned, it's a very good environment offering many plug-ins (Mylyn, SVN, ...).
MonoDevelop somewhat supports C++ (more and more, I didn't check the latest version).
I've used Eclipse for C/C++ and it's pretty useful. It's also used at ACM ICPC World Finals http://cm.baylor.edu/welcome.icpc
I'd recommand Code::Blocks (but use a nighty build). It can be coupled with gdb to enable step by step debugging and all that stuff.
Not exactly an IDE but SublimeText 2/3 is available on Linux now. There may be a debugger plugin for it too, who knows.
Edit
Here's a gdb plugin for SublimeText
I havn't explored it personally, but Emacs has a C++ development addon that looks very much like a full IDE.
About 7 years ago I used KDevelop that was shipped with KDE. I found it quite good back than, and I hope it also improved with the time. I found it quite comparable to VC++ 6 at this time.
It also contains Qt support, if you are in need for some GUI toolkit.
Depends, Code::Blocks is good, Eclipse is very nice too, but you will need a very good computer. In my opinion the best choice iss gcc, gdb and ViM or Gedit.
My buddies from work use Eclipse + Scons, they also use Valgrind(spelling?) for tracking memory leaks and such.
Many of the IDE features you listed were debugger features. The ddd (Data Display Debugger) debugger is quite a nice GUI wrapper for gdb, allowing graphical representation of data structures, a non-crappy source listing window (ie. unlike the l command of gdb where you don't get context), and also allows you to use any and all native gdb commands directly if desired.
Have a look at CodeLite. It's available for Ubuntu and Fedora out of the box and even for Windows and Mac. So you can have the same IDE on different platforms.
We tried Eclipse and NetBeans but left them due to their huge CPU and memory usage. We have a development server and all the developers connect to it via RDC. Thats why these IDEs miserably failed in our model.
So, we looked for some native IDE. Found CodeBlocks to be very good and super fast. We sort of settled on it but later found CodeLite and liked it better than CodeBlocks.
I just seeing this question after 12+ years. AnyHow I just writing my answer. I personally use Quincy IDE for C and C++ development. it is very lite weight and debugging watch list is very much good and easy to use. I'm just attaching the link to the site. try it.
But you have to install it with wine.
Quincy <-- Click here

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).