LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem compiling (error: ‘strcmp’ was not declared in this scope) (https://www.linuxquestions.org/questions/linux-newbie-8/problem-compiling-error-%91strcmp%92-was-not-declared-in-this-scope-776493/)

beboppinbobby 12-17-2009 01:17 PM

Problem compiling (error: ‘strcmp’ was not declared in this scope)
 
Here is my terminal log from the compile shell script:

================ Compiling MorphGen ===================
make: Entering directory `/home/#####/RML/Source/MorphGen'
g++ -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -MD -c -O3 -funroll-loops -fomit-frame-pointer -ftemplate-depth-35 MorphGen.cpp -o MorphGen.orst
In file included from ../LemmatizerLib/../MorphWizardLib/wizard.h:8,
from ../LemmatizerLib/StdMorph.h:12,
from MorphGen.cpp:7:
../LemmatizerLib/../MorphWizardLib/FormInfo.h: In member function ‘bool CLemmaInfo::operator==(const CLemmaInfo&) const’:
../LemmatizerLib/../MorphWizardLib/FormInfo.h:87: error: ‘strncmp’ was not declared in this scope
../LemmatizerLib/../MorphWizardLib/FormInfo.h: In member function ‘bool CLemmaInfo::operator<(const CLemmaInfo&) const’:
../LemmatizerLib/../MorphWizardLib/FormInfo.h:96: error: ‘strncmp’ was not declared in this scope
In file included from ../LemmatizerLib/MorphDictBuilder.h:9,
from MorphGen.cpp:10:
../LemmatizerLib/MorphDict.h: In member function ‘bool CMorphDict::IsLessMorphInterp::operator()(const CLemmaInfoAndLemma&, const char*) const’:
../LemmatizerLib/MorphDict.h:53: error: ‘strcmp’ was not declared in this scope
../LemmatizerLib/MorphDict.h: In member function ‘bool CMorphDict::IsLessMorphInterp::operator()(const char*, const CLemmaInfoAndLemma&) const’:
../LemmatizerLib/MorphDict.h:59: error: ‘strcmp’ was not declared in this scope
../LemmatizerLib/MorphDict.h: In member function ‘bool CMorphDict::IsLessMorphInterp::operator()(const CLemmaInfoAndLemma&, const CLemmaInfoAndLemma&) const’:
../LemmatizerLib/MorphDict.h:66: error: ‘strcmp’ was not declared in this scope
make: *** [MorphGen.orst] Error 1
make: Leaving directory `/home/#####/RML/Source/MorphGen'
======================
Error: cannot compile MorphGen


How do I get strcmp and strncmp included in this scope? Is the standard library not loading for some reason?

Thanks!

gerardorn 12-17-2009 01:29 PM

Quote:

../LemmatizerLib/../MorphWizardLib/FormInfo.h: In member function ‘bool CLemmaInfo::operator<(const CLemmaInfo&) const’:
../LemmatizerLib/../MorphWizardLib/FormInfo.h:96: error: ‘strncmp’ was not declared in this scope
should be strcmp not strncmp

beboppinbobby 12-18-2009 11:51 AM

Quote:

Originally Posted by gerardorn (Post 3795773)
should be strcmp not strncmp

I was searching online and it appears that both are standard functions in string.h.

But why isn't my compiler using them?

smeezekitty 12-18-2009 05:36 PM

#include <string.h>

evo2 12-19-2009 01:33 AM

Quote:

Originally Posted by smeezekitty (Post 3797311)
#include <string.h>

Actaully since it is c++, not c it is better to use:

#include <cstring>

Evo2


All times are GMT -5. The time now is 05:22 AM.