Downgrade g++ compiler on Ubuntu (compilation of PLINK and redeclaration errors)

I wanted to make a few modifications to the PLINK source code so that we can have it work with our organism for some GWAS. I was unable to compile with g++ version 4.7.2 since the PLINK code base redeclares variables after a previous declaration, and 4.7 does not permit variables to be redeclared. The easiest way around this was to downgrade compilers, since g++ 4.6 permits redeclaration. On Ubuntu this was as easy as:
sudo apt-get install g++-4.6
and specifying g++-4.6 as the compiler in the Makefile. This doesn't change the default version invoked with g++ (i.e. g++ -v at the CL still returns 4.7).

In summary:
g++ v4.7 stops with errors:
sets.cpp: In member function ‘vector_t Set::profileTestScore()’:
sets.cpp:771:37: error: redeclaration of ‘std::vector<individual>::iterator i’
sets.cpp:703:12: error: ‘int i’ previously declared here
g++ v4.6 proceeds with a few warnings

Comments

Popular Posts