Sunday, September 30, 2012

Android source code build error

There are some issues I have faced while building the android source code ...

I have listed it and of-course  solution too  :)


/bin/bash: prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc: Permission denied
soln : change the permission

prebuilt/linux-x86/sdl/bin/sdl-config: Permission denied
soln : change the permission


/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
 soln : apt-get install gcc-multilib  On x86_64 with debian / ubuntu / mint:
 

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so when searching for -lstdc++

/usr/bin/ld: cannot find -lstdc++

Soln : sudo ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so


btw if you get the permission denied error still , do the following

chmod -Rf 777  <android_SRC>

Sunday, September 16, 2012

Something about freind in C++

There are some threads debating about friend class , is violating encapsulation (one of the important oops concept). there are some genuine case where we need friend ..

Before that we will discuss about the friend class  .. not much   briefly  :)

well, A very good name given to this concept by the inventor. In general , we are sharing our personal (private) data to our friends only  . Similarly A Class can share its  private data to its friend class .

   lets look at this code

    class nanban;

   class dude
    {
    int data ;
    friend class nanban;
    } ;


now , nanban class has the privilege to access dude class's private data ..

Coming to the point , where it can be used

  Unit testing
       To accomplish this , we need to write some additional piece of code to test the main code . There we can't write additional function for this purpose .
lets take the above example

dude class only contains data (by default it is private) , I want to test the value of data from the testing framework , Instead of writing a public function (introducing function increases .exe size) which will return the value of data , I am making nanban class as friend of dude .So that I can get the value directly. 

   Well , thats it . any quires !!!