Sharing experience in C++11 for Android NDK

In my free time I started to work on simple C++ game and there are a little bit complexity: I use Android NDK. Yes, this is for mobile and I use not native Java, but native-native C++, Open GL and other cool things =). All goes very interesting and I will continue grow up with this project and probably later I will create a couple of posts about my advantages with it. For now I published very-draft PC-version (which I already fully re-worked for Android): GitHub.

Since I didn't use C++ for a year I returned to some books and I have found a latest book The C++ Programming Language (4th Edition)from Stroustrup.

  

Many interesting news out there, but we need a latest compiler for all this staff. So, for example, I couldn't compile some examples with gcc4.7 on Linux. And I found an article where author desribed "how to compile-and-run latest gcc4.8.2 on your machine" in details, here is: http://eli.thegreenplace.net/2014/01/16/building-gcc-4-8-from-source-on-ubunu-12-04/.

One thing I should note, that for Linux x64 you should add 32-bit libraries:

sudo apt-get install libc6-dev-i386

I compiled test examples, like in article one. And here is I want to share how to integrate compiled project into Eclipse:

  • 1. Create C++ project in Eclipse, and write something from Standard 2013. Actually I used Eclipse from Android Developer Tools. Get examples from the book.
  • 2. In the Project Properties create configuration:
  • Project -> Properties -> C/C+++ Build -> Manage Configurations -> create new
  • 3. Make configuration Active
  • 4. Go to C/C++Build -> Discovery -> Compiler invocation command --> and put path to your compiler, for example ./root/install/gcc-4.8.2/bin/gcc4.8
  • 5. Go to С/C++Build -> Settings -> Tool Settings -> Miscellaneous and wirte to "Other flags": -std=C++11 to include latest toys =)

    Ready!

  • Комментарии

    Популярные

    Кастомизируем ASP.NET Identity 2.0

    Делаем себе бесплатный VPN на Amazon EC2

    Выбираем все плюсы из трех парадигм Entity Framework