hackorama/AnyOption — Issue #1: [PATCH] can't compile on Ubuntu 11.04 with gcc-4.6
Author: orbitcowboy
Created: 2011-10-13 12:17:28+00:00
State: open

compiling fails with:

$ g++ anyoption.cpp demo.cpp -I.
anyoption.cpp: In member function ‘void AnyOption::init(int, int)’:
anyoption.cpp:131:33: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘void AnyOption::setCommandLongPrefix(char*)’:
anyoption.cpp:276:22: error: ‘strlen’ was not declared in this scope
anyoption.cpp:280:35: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘char AnyOption::parsePOSIX(char*)’:
anyoption.cpp:655:42: error: ‘strlen’ was not declared in this scope
anyoption.cpp: In member function ‘int AnyOption::parseGNU(char*)’:
anyoption.cpp:683:42: error: ‘strlen’ was not declared in this scope
anyoption.cpp: In member function ‘int AnyOption::matchOpt(char*)’:
anyoption.cpp:717:31: error: ‘strcmp’ was not declared in this scope
anyoption.cpp: In member function ‘char* AnyOption::getValue(const char*)’:
anyoption.cpp:785:34: error: ‘strcmp’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::getFlag(const char*)’:
anyoption.cpp:797:34: error: ‘strcmp’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::findFlag(char*)’:
anyoption.cpp:833:30: error: ‘strcmp’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::setValue(const char*, char*)’:
anyoption.cpp:848:48: error: ‘strcmp’ was not declared in this scope
anyoption.cpp:849:80: error: ‘strlen’ was not declared in this scope
anyoption.cpp:850:65: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::setFlagOn(const char*)’:
anyoption.cpp:863:48: error: ‘strcmp’ was not declared in this scope
anyoption.cpp:864:84: error: ‘strlen’ was not declared in this scope
anyoption.cpp:865:72: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::setValue(char, char*)’:
anyoption.cpp:879:81: error: ‘strlen’ was not declared in this scope
anyoption.cpp:880:67: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::setFlagOn(char)’:
anyoption.cpp:894:85: error: ‘strlen’ was not declared in this scope
anyoption.cpp:895:50: error: ‘strcpy’ was not declared in this scope
anyoption.cpp: In member function ‘bool AnyOption::consumeFile(char*)’:
anyoption.cpp:980:54: error: ‘strlen’ was not declared in this scope
anyoption.cpp: In member function ‘char* AnyOption::chomp(char*)’:
anyoption.cpp:1056:35: error: ‘strlen’ was not declared in this scope
anyoption.cpp: In member function ‘void AnyOption::valuePairs(char*, char*)’:
anyoption.cpp:1066:25: error: ‘strlen’ was not declared in this scope
anyoption.cpp:1080:32: error: ‘strcmp’ was not declared in this scope
anyoption.cpp: In member function ‘void AnyOption::justValue(char*)’:
anyoption.cpp:1098:25: error: ‘strlen’ was not declared in this scope
anyoption.cpp:1112:32: error: ‘strcmp’ was not declared in this scope
$

Please refer the attached patch that fixed the issue:

diff --git a/anyoption.h b/anyoption.h
index 01501df..5a70077 100755
--- a/anyoption.h
+++ b/anyoption.h
@@ -5,6 +5,7 @@
#include
#include
#include
+#include

#define COMMON_OPT	1
#define COMMAND_OPT	2

Best regards

Martin Ettl