ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hey, I'm trying to get up and running using Eclipse, but I cant even do the simplest program. Literally a program with an empty main() function and just #include <iostream> gives a mass of errors. The only similar issue I can find on the web is when the file is named the same as an STL file, which is not the case for me. Copy/paste of errors below. Any help much appreciated!
In file included from /usr/include/c++/4.2/x86_64-linux-gnu/bits/c++locale.h:47,
from /usr/include/c++/4.2/iosfwd:45,
from /usr/include/c++/4.2/ios:43,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/cstring:80: error: ‘::memcpy’ has not been declared
/usr/include/c++/4.2/cstring:81: error: ‘::memmove’ has not been declared
/usr/include/c++/4.2/cstring:82: error: ‘::strcpy’ has not been declared
/usr/include/c++/4.2/cstring:83: error: ‘::strncpy’ has not been declared
/usr/include/c++/4.2/cstring:84: error: ‘::strcat’ has not been declared
/usr/include/c++/4.2/cstring:85: error: ‘::strncat’ has not been declared
/usr/include/c++/4.2/cstring:86: error: ‘::memcmp’ has not been declared
/usr/include/c++/4.2/cstring:87: error: ‘::strcmp’ has not been declared
/usr/include/c++/4.2/cstring:88: error: ‘::strcoll’ has not been declared
/usr/include/c++/4.2/cstring:89: error: ‘::strncmp’ has not been declared
/usr/include/c++/4.2/cstring:90: error: ‘::strxfrm’ has not been declared
/usr/include/c++/4.2/cstring:91: error: ‘::strcspn’ has not been declared
/usr/include/c++/4.2/cstring:92: error: ‘::strspn’ has not been declared
/usr/include/c++/4.2/cstring:93: error: ‘::strtok’ has not been declared
/usr/include/c++/4.2/cstring:94: error: ‘::memset’ has not been declared
/usr/include/c++/4.2/cstring:95: error: ‘::strerror’ has not been declared
/usr/include/c++/4.2/cstring:96: error: ‘::strlen’ has not been declared
/usr/include/c++/4.2/cstring:98: error: ‘::memchr’ has not been declared
/usr/include/c++/4.2/cstring: In function ‘void* std::memchr(void*, int, size_t)’:
/usr/include/c++/4.2/cstring:102: error: invalid conversion from ‘const void*’ to ‘void*’
/usr/include/c++/4.2/cstring:102: error: initialising argument 1 of ‘void* std::memchr(void*, int, size_t)’
/usr/include/c++/4.2/cstring: At global scope:
/usr/include/c++/4.2/cstring:104: error: ‘::strchr’ has not been declared
/usr/include/c++/4.2/cstring:110: error: ‘::strpbrk’ has not been declared
/usr/include/c++/4.2/cstring:116: error: ‘::strrchr’ has not been declared
/usr/include/c++/4.2/cstring:122: error: ‘::strstr’ has not been declared
In file included from /usr/include/c++/4.2/bits/char_traits.h:46,
from /usr/include/c++/4.2/ios:45,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/stl_algobase.h: In static member function ‘static _Tp* std::__copy<true, std::random_access_iterator_tag>::copy(const _Tp*, const _Tp*, _Tp*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:298: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In static member function ‘static _Tp* std::__copy_backward<true, std::random_access_iterator_tag>::__copy_b(const _Tp*, const _Tp*, _Tp*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:446: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(unsigned char*, unsigned char*, const unsigned char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:600: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(signed char*, signed char*, const signed char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:608: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(char*, char*, const char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:616: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘bool std::lexicographical_compare(const unsigned char*, const unsigned char*, const unsigned char*, const unsigned char*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:908: error: ‘memcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/ios:45,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static typename __gnu_cxx::char_traits<_CharT>::char_type* __gnu_cxx::char_traits<_CharT>::move(_CharT*, const _CharT*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:186: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static int std::char_traits<char>::compare(const char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:254: error: ‘memcmp’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static size_t std::char_traits<char>::length(const char*)’:
/usr/include/c++/4.2/bits/char_traits.h:258: error: ‘strlen’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static const char* std::char_traits<char>::find(const char*, size_t, const char&)’:
/usr/include/c++/4.2/bits/char_traits.h:262: error: invalid conversion from ‘const void*’ to ‘void*’
/usr/include/c++/4.2/bits/char_traits.h:262: error: initialising argument 1 of ‘void* std::memchr(void*, int, size_t)’
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::move(char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:266: error: ‘memmove’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::copy(char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:270: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::assign(char*, size_t, char)’:
/usr/include/c++/4.2/bits/char_traits.h:274: error: ‘memset’ was not declared in this scope
In file included from /usr/include/c++/4.2/memory:57,
from /usr/include/c++/4.2/string:48,
from /usr/include/c++/4.2/bits/locale_classes.h:47,
from /usr/include/c++/4.2/bits/ios_base.h:47,
from /usr/include/c++/4.2/ios:48,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/stl_uninitialized.h: In function ‘char* std::uninitialized_copy(const char*, const char*, char*)’:
/usr/include/c++/4.2/bits/stl_uninitialized.h:120: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_uninitialized.h: In function ‘wchar_t* std::uninitialized_copy(const wchar_t*, const wchar_t*, wchar_t*)’:
/usr/include/c++/4.2/bits/stl_uninitialized.h:128: error: ‘memmove’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/ios_base.h:47,
from /usr/include/c++/4.2/ios:48,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_classes.h: In member function ‘bool std::locale::_Impl::_M_check_same_name()’:
/usr/include/c++/4.2/bits/locale_classes.h:539: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘const char* std::ctype<char>::widen(const char*, const char*, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:898: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘const char* std::ctype<char>::narrow(const char*, const char*, char, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:963: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘virtual const char* std::ctype<char>::do_widen(const char*, const char*, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:1100: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘virtual const char* std::ctype<char>::do_narrow(const char*, const char*, char, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:1153: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘void std::ctype<char>::_M_widen_init() const’:
/usr/include/c++/4.2/bits/locale_facets.h:1168: error: ‘memcmp’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘void std::ctype<char>::_M_narrow_init() const’:
/usr/include/c++/4.2/bits/locale_facets.h:1183: error: ‘memcmp’ was not declared in this scope
In file included from /usr/include/c++/4.2/bits/locale_facets.h:1536,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/codecvt.h: In constructor ‘std::codecvt_byname<_InternT, _ExternT, _StateT>::codecvt_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/codecvt.h:460: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/codecvt.h:460: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::numpunct_byname<_CharT>::numpunct_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:1904: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:1904: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::collate_byname<_CharT>::collate_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:2726: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:2726: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/locale_facets.h:3040,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h: In constructor ‘std::__timepunct<_CharT>::__timepunct(__locale_struct*, const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h:62: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h:64: error: ‘memcpy’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::moneypunct_byname<_CharT, _Intl>::moneypunct_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:4014: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:4014: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/locale_facets.h:4599,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h: In constructor ‘std::messages<_CharT>::messages(__locale_struct*, const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:55: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:57: error: ‘memcpy’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h: In constructor ‘std::messages_byname<_CharT>::messages_byname(const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:105: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:106: error: ‘strcpy’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:109: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:109: error: ‘strcmp’ is not a member of ‘std’
make: *** [MainApp.o] Error 1
make: Target `all' not remade because of errors.
Hey, I'm trying to get up and running using Eclipse, but I cant even do the simplest program. Literally a program with an empty main() function and just #include <iostream> gives a mass of errors. The only similar issue I can find on the web is when the file is named the same as an STL file, which is not the case for me. Copy/paste of errors below. Any help much appreciated!
In file included from /usr/include/c++/4.2/x86_64-linux-gnu/bits/c++locale.h:47,
from /usr/include/c++/4.2/iosfwd:45,
from /usr/include/c++/4.2/ios:43,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/cstring:80: error: ‘::memcpy’ has not been declared
/usr/include/c++/4.2/cstring:81: error: ‘::memmove’ has not been declared
/usr/include/c++/4.2/cstring:82: error: ‘::strcpy’ has not been declared
/usr/include/c++/4.2/cstring:83: error: ‘::strncpy’ has not been declared
/usr/include/c++/4.2/cstring:84: error: ‘::strcat’ has not been declared
/usr/include/c++/4.2/cstring:85: error: ‘::strncat’ has not been declared
/usr/include/c++/4.2/cstring:86: error: ‘::memcmp’ has not been declared
/usr/include/c++/4.2/cstring:87: error: ‘::strcmp’ has not been declared
/usr/include/c++/4.2/cstring:88: error: ‘::strcoll’ has not been declared
/usr/include/c++/4.2/cstring:89: error: ‘::strncmp’ has not been declared
/usr/include/c++/4.2/cstring:90: error: ‘::strxfrm’ has not been declared
/usr/include/c++/4.2/cstring:91: error: ‘::strcspn’ has not been declared
/usr/include/c++/4.2/cstring:92: error: ‘::strspn’ has not been declared
/usr/include/c++/4.2/cstring:93: error: ‘::strtok’ has not been declared
/usr/include/c++/4.2/cstring:94: error: ‘::memset’ has not been declared
/usr/include/c++/4.2/cstring:95: error: ‘::strerror’ has not been declared
/usr/include/c++/4.2/cstring:96: error: ‘::strlen’ has not been declared
/usr/include/c++/4.2/cstring:98: error: ‘::memchr’ has not been declared
/usr/include/c++/4.2/cstring: In function ‘void* std::memchr(void*, int, size_t)’:
/usr/include/c++/4.2/cstring:102: error: invalid conversion from ‘const void*’ to ‘void*’
/usr/include/c++/4.2/cstring:102: error: initialising argument 1 of ‘void* std::memchr(void*, int, size_t)’
/usr/include/c++/4.2/cstring: At global scope:
/usr/include/c++/4.2/cstring:104: error: ‘::strchr’ has not been declared
/usr/include/c++/4.2/cstring:110: error: ‘::strpbrk’ has not been declared
/usr/include/c++/4.2/cstring:116: error: ‘::strrchr’ has not been declared
/usr/include/c++/4.2/cstring:122: error: ‘::strstr’ has not been declared
In file included from /usr/include/c++/4.2/bits/char_traits.h:46,
from /usr/include/c++/4.2/ios:45,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/stl_algobase.h: In static member function ‘static _Tp* std::__copy<true, std::random_access_iterator_tag>::copy(const _Tp*, const _Tp*, _Tp*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:298: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In static member function ‘static _Tp* std::__copy_backward<true, std::random_access_iterator_tag>::__copy_b(const _Tp*, const _Tp*, _Tp*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:446: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(unsigned char*, unsigned char*, const unsigned char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:600: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(signed char*, signed char*, const signed char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:608: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘void std::fill(char*, char*, const char&)’:
/usr/include/c++/4.2/bits/stl_algobase.h:616: error: ‘memset’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_algobase.h: In function ‘bool std::lexicographical_compare(const unsigned char*, const unsigned char*, const unsigned char*, const unsigned char*)’:
/usr/include/c++/4.2/bits/stl_algobase.h:908: error: ‘memcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/ios:45,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static typename __gnu_cxx::char_traits<_CharT>::char_type* __gnu_cxx::char_traits<_CharT>::move(_CharT*, const _CharT*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:186: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static int std::char_traits<char>::compare(const char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:254: error: ‘memcmp’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static size_t std::char_traits<char>::length(const char*)’:
/usr/include/c++/4.2/bits/char_traits.h:258: error: ‘strlen’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static const char* std::char_traits<char>::find(const char*, size_t, const char&)’:
/usr/include/c++/4.2/bits/char_traits.h:262: error: invalid conversion from ‘const void*’ to ‘void*’
/usr/include/c++/4.2/bits/char_traits.h:262: error: initialising argument 1 of ‘void* std::memchr(void*, int, size_t)’
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::move(char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:266: error: ‘memmove’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::copy(char*, const char*, size_t)’:
/usr/include/c++/4.2/bits/char_traits.h:270: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/char_traits.h: In static member function ‘static char* std::char_traits<char>::assign(char*, size_t, char)’:
/usr/include/c++/4.2/bits/char_traits.h:274: error: ‘memset’ was not declared in this scope
In file included from /usr/include/c++/4.2/memory:57,
from /usr/include/c++/4.2/string:48,
from /usr/include/c++/4.2/bits/locale_classes.h:47,
from /usr/include/c++/4.2/bits/ios_base.h:47,
from /usr/include/c++/4.2/ios:48,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/stl_uninitialized.h: In function ‘char* std::uninitialized_copy(const char*, const char*, char*)’:
/usr/include/c++/4.2/bits/stl_uninitialized.h:120: error: ‘memmove’ is not a member of ‘std’
/usr/include/c++/4.2/bits/stl_uninitialized.h: In function ‘wchar_t* std::uninitialized_copy(const wchar_t*, const wchar_t*, wchar_t*)’:
/usr/include/c++/4.2/bits/stl_uninitialized.h:128: error: ‘memmove’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/ios_base.h:47,
from /usr/include/c++/4.2/ios:48,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_classes.h: In member function ‘bool std::locale::_Impl::_M_check_same_name()’:
/usr/include/c++/4.2/bits/locale_classes.h:539: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘const char* std::ctype<char>::widen(const char*, const char*, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:898: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘const char* std::ctype<char>::narrow(const char*, const char*, char, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:963: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘virtual const char* std::ctype<char>::do_widen(const char*, const char*, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:1100: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘virtual const char* std::ctype<char>::do_narrow(const char*, const char*, char, char*) const’:
/usr/include/c++/4.2/bits/locale_facets.h:1153: error: ‘memcpy’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘void std::ctype<char>::_M_widen_init() const’:
/usr/include/c++/4.2/bits/locale_facets.h:1168: error: ‘memcmp’ was not declared in this scope
/usr/include/c++/4.2/bits/locale_facets.h: In member function ‘void std::ctype<char>::_M_narrow_init() const’:
/usr/include/c++/4.2/bits/locale_facets.h:1183: error: ‘memcmp’ was not declared in this scope
In file included from /usr/include/c++/4.2/bits/locale_facets.h:1536,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/codecvt.h: In constructor ‘std::codecvt_byname<_InternT, _ExternT, _StateT>::codecvt_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/codecvt.h:460: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/codecvt.h:460: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::numpunct_byname<_CharT>::numpunct_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:1904: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:1904: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::collate_byname<_CharT>::collate_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:2726: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:2726: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/locale_facets.h:3040,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h: In constructor ‘std::__timepunct<_CharT>::__timepunct(__locale_struct*, const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h:62: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/time_members.h:64: error: ‘memcpy’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/bits/locale_facets.h: In constructor ‘std::moneypunct_byname<_CharT, _Intl>::moneypunct_byname(const char*, size_t)’:
/usr/include/c++/4.2/bits/locale_facets.h:4014: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/bits/locale_facets.h:4014: error: ‘strcmp’ is not a member of ‘std’
In file included from /usr/include/c++/4.2/bits/locale_facets.h:4599,
from /usr/include/c++/4.2/bits/basic_ios.h:44,
from /usr/include/c++/4.2/ios:50,
from /usr/include/c++/4.2/ostream:45,
from /usr/include/c++/4.2/iostream:45,
from ../MainApp.cpp:2:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h: In constructor ‘std::messages<_CharT>::messages(__locale_struct*, const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:55: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:57: error: ‘memcpy’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h: In constructor ‘std::messages_byname<_CharT>::messages_byname(const char*, size_t)’:
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:105: error: ‘strlen’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:106: error: ‘strcpy’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:109: error: ‘strcmp’ is not a member of ‘std’
/usr/include/c++/4.2/x86_64-linux-gnu/bits/messages_members.h:109: error: ‘strcmp’ is not a member of ‘std’
make: *** [MainApp.o] Error 1
make: Target `all' not remade because of errors.
What is the full command line for the compilation? It seems like it might be a #define (from the command line?) that's preventing a C header from being included by the C++ header.
ta0kira
2. It's OK to use namespaces inside a .cpp source file.
It's also OK to use namespaces inside a .h header file.
3. But you should #include your headers OUTSIDE of the namespace.
Code:
/*
* EXAMPLE:
* http://www.cplusplus.com/doc/tutorial/namespaces/
*/
// namespaces
#include <iostream>
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main () {
cout << first::var << endl;
cout << second::var << endl;
return 0;
}
Code:
// using
#include <iostream>
using namespace std;
namespace first
{
int x = 5;
int y = 10;
}
namespace second
{
double x = 3.1416;
double y = 2.7183;
}
int main () {
using first::x;
using second::y;
cout << x << endl;
cout << y << endl;
cout << first::y << endl;
cout << second::x << endl;
return 0;
}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.