At LabKey, I run into this problem over and over again. I assist a customer migrate their Proteomics pipeline to new hardware (and a newer linux distribution) and none of the older Proteomics tools compile properly. I received an email from a customer, yesterday asking for assistance in compiling PepMatch. The customer was trying to compile the software on RHEL6.2. They were getting the error
[labkey@server pepmatch]$ make ... g++ -O2 -DGCC -c -o InspectResultsParser.o InspectResultsParser.cpp In file included from PepResultsParser.h:4, from InspectResultsParser.cpp:7: saxhandler.h: In member function ‘bool SAXHandler::isElement(const char*, const XML_Char*)’: saxhandler.h:61: error: ‘strcmp’ was not declared in this scope saxhandler.h: In member function ‘bool SAXHandler::isAttr(const char*, const XML_Char*)’: saxhandler.h:64: error: ‘strcmp’ was not declared in this scope InspectResultsParser.cpp: In function ‘char* prepareAppend(char*)’: InspectResultsParser.cpp:12: error: ‘strlen’ was not declared in this scope InspectResultsParser.cpp: In member function ‘bool InspectResultsParser::parse()’: InspectResultsParser.cpp:66: error: ‘strstr’ was not declared in this scope InspectResultsParser.cpp:118: error: ‘strcasecmp’ was not declared in this scope make: *** [InspectResultsParser.o] Error 1
I vaguely remembered this occurring before, but could not find anything in my notes or email about it. After a bit of googling, I found GCC 4.3 Release Series Porting to the New Tools, which says,
As detailed here (Header dependency streamlining), many of the standard C++ library include files have been edited to only include the smallest possible number of additional files. As such, many C++ programs that used std::memcpy without including <cstring>, or used std::auto_ptr without including <memory> will no longer compile.
Usually, this error is of the form:
error: 'strcmp' was not declared in this scope
Sure enough, I added
#include <cscript> to the saxhandler.h file and the compile successfully completed.
I posted this here so I can find it the next time either I or a customer experience a problem like this.