This is with version 2.4.14. Version 2.4.13-r1 does not work either. The efence webpage says that the development under the name efence has stopped and that it is now developed by someone else under the name duma. Maybe it is fixed there? $ echo "#include <string>"|g++ -x c++ -c -o /dev/null -include new -include efencepp.h - /usr/include/string.h:38: error: expected identifier before string constant /usr/include/string.h:38: error: expected ',' or '...' before string constant /usr/include/string.h:40: error: declaration of C function 'void* _eff_memcpy(void*, const void*, size_t, int)' conflicts with /usr/include/efence.h:106: error: previous declaration 'void* _eff_memcpy(void*, const void*, size_t, const char*, int)' here /usr/include/string.h:84: error: expected identifier before string constant /usr/include/string.h:84: error: expected ',' or '...' before string constant /usr/include/string.h:85: error: declaration of C function 'char* _eff_strcpy(char*, const char*, int)' conflicts with /usr/include/efence.h:107: error: previous declaration 'char* _eff_strcpy(char*, const char*, const char*, int)' here /usr/include/string.h:87: error: expected identifier before string constant /usr/include/string.h:87: error: expected ',' or '...' before string constant /usr/include/string.h:89: error: declaration of C function 'char* _eff_strncpy(char*, const char*, size_t, int)' conflicts with /usr/include/efence.h:108: error: previous declaration 'char* _eff_strncpy(char*, const char*, size_t, const char*, int)' here /usr/include/string.h:92: error: expected identifier before string constant /usr/include/string.h:92: error: expected ',' or '...' before string constant /usr/include/string.h:93: error: declaration of C function 'char* _eff_strcat(char*, const char*, int)' conflicts with /usr/include/efence.h:109: error: previous declaration 'char* _eff_strcat(char*, const char*, const char*, int)' here /usr/include/string.h:95: error: expected identifier before string constant /usr/include/string.h:95: error: expected ',' or '...' before string constant /usr/include/string.h:95: error: declaration of C function 'char* _eff_strncat(char*, const char*, size_t, int)' conflicts with /usr/include/efence.h:110: error: previous declaration 'char* _eff_strncat(char*, const char*, size_t, const char*, int)' here /usr/include/string.h:130: error: expected identifier before string constant /usr/include/string.h:130: error: expected ',' or '...' before string constant /usr/include/string.h:131: error: declaration of C function 'char* _eff_strdup(const char*, int)' conflicts with /usr/include/efence.h:105: error: previous declaration 'char* _eff_strdup(const char*, const char*, int)' here /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/cstring:81: error: '::memcpy' has not been declared /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/cstring:83: error: '::strcpy' has not been declared /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/cstring:84: error: '::strncpy' has not been declared /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/cstring:85: error: '::strcat' has not been declared /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/cstring:86: error: '::strncat' has not been declared /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/char_traits.h: In static member function 'static char* std::char_traits<char>::copy(char*, const char*, size_t)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/char_traits.h:269: error: 'memcpy' was not declared in this scope /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h: In member function '_Tp* __gnu_cxx::new_allocator<_Tp>::allocate(size_t, const void*)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:90: error: 'operator new("/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h", 90)' cannot be used as a function /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h: In member function 'void __gnu_cxx::new_allocator<_Tp>::deallocate(_Tp*, size_t)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:96: error: expected operator before 'for' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:96: error: expected `;' before 'for' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:96: error: expected `;' before ')' token /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h: In member function 'void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:106: error: expected type-specifier before '__p' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:106: error: expected `)' before '__p' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/ext/new_allocator.h:106: error: expected `;' before '__p' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h: In function 'void std::_Construct(_T1*, const _T2&)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:81: error: expected type-specifier before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:81: error: expected `)' before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:81: error: expected `;' before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h: In function 'void std::_Construct(_T1*)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:96: error: expected type-specifier before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:96: error: expected `)' before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_construct.h:96: error: expected `;' before 'static_cast' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory: In function 'std::pair<_Tp*, int> std::__get_temporary_buffer(ptrdiff_t, _Tp*)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory:84: error: 'operator new("/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory", 83)' cannot be used as a function /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory: In function 'void std::return_temporary_buffer(_Tp*)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory:124: error: expected operator before 'for' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory:124: error: expected `;' before 'for' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/memory:124: error: expected `;' before ')' token /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/basic_string.tcc: In static member function 'static typename std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const _Alloc&)': /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/basic_string.tcc:589: error: expected type-specifier before '__place' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/basic_string.tcc:589: error: expected `)' before '__place' /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/bits/basic_string.tcc:589: error: expected ',' or ';' before '__place'
It also fails for C: $ echo "#include <string.h>"|gcc -x c -c -o /dev/null -include stdlib.h -include efence.h - In file included from <stdin>:1: /usr/include/string.h:38: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:38: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:40: error: conflicting types for '_eff_memcpy' /usr/include/efence.h:106: error: previous declaration of '_eff_memcpy' was here /usr/include/string.h:84: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:84: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:85: error: conflicting types for '_eff_strcpy' /usr/include/efence.h:107: error: previous declaration of '_eff_strcpy' was here /usr/include/string.h:87: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:87: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:89: error: conflicting types for '_eff_strncpy' /usr/include/efence.h:108: error: previous declaration of '_eff_strncpy' was here /usr/include/string.h:92: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:92: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:93: error: conflicting types for '_eff_strcat' /usr/include/efence.h:109: error: previous declaration of '_eff_strcat' was here /usr/include/string.h:95: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:95: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:95: error: conflicting types for '_eff_strncat' /usr/include/efence.h:110: error: previous declaration of '_eff_strncat' was here /usr/include/string.h:130: error: expected declaration specifiers or '...' before string constant /usr/include/string.h:130: error: expected declaration specifiers or '...' before numeric constant /usr/include/string.h:131: error: conflicting types for '_eff_strdup' /usr/include/efence.h:105: error: previous declaration of '_eff_strdup' was here
(In reply to comment #0) effence need exact position of including #include <new> #include <string> #include <effencepp.h> or echo "#include <efence.h>" |g++ -x c++ -c -o /dev/null -include string -include new - (In reply to comment #1) I try file with #include <stdlib.h> #include <string.h> #include <efence.h> I think that problem is still. You must define string or string.h before efence.
Thank you for your help. It seems like "-include new -include fstream -include efencepp.h" is the magic string that I need to add to the CCFLAGS to build the C++ application with efence enabled. The drawback is that the compiler has to process fstream for each file that it compiles, wether it is needed or not.