Need to re-Port a C++ source code to OSX10.7

Hi,

I am trying to port a C++ Genetics program called PHASE on behalf of the Author to OSX10.7 as the last time I did it was in PowerPC architecture. Unsurprisingly just running $ make doesn't work. I get the following error message:


$ make

g++ -O2 -DBIGDATASETS -I. -I.. -c phase.cpp

In file included from /usr/include/c++/4.2.1/backward/strstream:51,

from ./tnt/vec.h:35,

from tnt/cmat.h:42,

from classpop.hpp:19,

from phase.cpp:5:

/usr/include/c++/4.2.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

In file included from classpop.hpp:15,

from phase.cpp:5:

HapList2.hpp:59: error: extra qualification ‘HapList::’ on member ‘Add’

HapList2.hpp:60: error: extra qualification ‘HapList::’ on member ‘Add’

make: *** [phase.o] Error 1


I have no idea how to try and fix this problem. Is there anyone out there familiar with porting C++ source code to OSX10.7 that may be able to help.


many thanks


Matt

iMac, Mac OS X (10.7.3), 27" i7

Posted on Mar 22, 2012 11:01 AM

Reply
6 replies

Mar 22, 2012 12:52 PM in response to mattnev

Well, it's rather difficult to know without actually seeing hte source code...but at a guess, the HapList2.hpp includes a class declaration for a class called HapList (or maybe even a class definition...who knows). In the declaration is a member attribute or function called Add. I'll assume it's a function. And it's been declared something like this:


class HapList
{
public:
HapList::Add();
};


That is wrong. It should be declared like this:


class HapList

{

public:

Add();

};


Old versions of g++ (and Visual C++) allow member declarations to use qualified names, but it's a syntax error in standard C++. Member declarations must use unqualified names for the members themselves.


I wouldn't be surprised if you need to go through and clean up a lot of badly written code.


For the warning, you can either find all the old header includes and fix them (like the message told you) or suppress the warning using -Wno-deprecated as a command line flag to teh compiler.

Mar 23, 2012 3:06 AM in response to etresoft

Hi etresoft,


Many thanks for your reply.

The problem is I had nothing to do with the writing of the source code I just need the program for my work and upgrading to Lion means the PowerPC ported version doesn't work. I have ported a number of different incarnations this program a few times and each time there is a different problem and the source code that worked with my last port (including a fix) doesn't work under Lion. I am hoping that someone like me who is a lab scientist who knows next to nothing about C++ can fix this problem.

Mar 23, 2012 3:41 AM in response to g_wolfman

Hi g_wolfmanand many thanks for replying,


In the header file HapList2.hpp there is the following that seems to fit your description:

------------------------------------------------------------------

class HapList {


public:

ListType haplist; // list of haplotypes and frequencies

vector<ListType::iterator> PositiveHaps; // pointers to haps with positive frequency


public:

HapList ();

HapList (const HapList &);

HapList (istream & istr);

HapList (const HapList &, int firstlocus, int lastlocus); // extract


//list from first up to (but not including) last

HapList (const HapList &, const HapList &, double minfreq=0.0); // concatenate two haplists

HapList (const HapList &, const HapList &, vector<CIndividual> & pop, double minfreq=0.0); // concatenate two haplists, but only include haps that can exist in pop



const HapList & operator = (const HapList &);


~HapList();



// the next two functions respectively


// add a record whose Freq, PseudoCounts, and Prob are


// the product, or minimum, of 2 other records


// (used in concatenating two haplists)

void AddMultiple(const Haplotype &, const HapRecord &, const HapRecord &);

void AddMin(const Haplotype &, const HapRecord &, const HapRecord &);

void Add (const HapList & h1, double minfreq);

void Add(const Haplotype &, const HapRecord &);

void Add(const Haplotype &, double freq = 1.0);

void Add(CIndividual &,int,bool,double freq = 1.0);

void Add(CIndividual &,double freq = 1.0,bool = false);

void Add(vector<CIndividual> & pop,int, bool = false);



// Add routines that return pointers to the added haplotype

ListType::iterator HapList::Add (CIndividual & ind, int chr, double freq, bool & isnewhap, bool usebestguess = false);

ListType::iterator HapList::Add (const Haplotype & h, double freq, bool & isnewhap);


ListType::iterator Find(const Haplotype & h, const vector<int> & uselist);


------------------------------------------------------------------


How would you suggest I modify this?.


regards


Matt

Mar 23, 2012 5:28 AM in response to g_wolfman

Update:


Following my previous message I have had a go and it seems to have worked so many thanks. I had to do simmilar in a few header files but the make has now completed sucessfully. I am just testing that it runs the same.


As to the warnings about the depreciated headers, at the moment I have just ignored them as it hasn't stopped the porting and I wasn't sure where to put the -Wno-deprecated command. Is this likely to cause problems with my ported app?.


thanks again


Matt

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Need to re-Port a C++ source code to OSX10.7

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.