cgal
cgal copied to clipboard
error: ‘strcpy’ was not declared in this scope
Ubuntu 14.04 LTS gcc 4.9
In file included from /home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze.cpp:25:0,
from /home/ren/Compile/CGAL/cgal/build/Debug/Installation/src/CGAL_ImageIO/all_files.cpp:1:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h: In function ‘imformat* createAnalyzeFormat()’:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:201:54: error: ‘strcpy’ was not declared in this scope
strcpy(f->fileExtension,".hdr,.hdr.gz,.img,.img.gz");
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h: In function ‘int testAnalyzeHeader(char*, const char*)’:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:209:39: error: ‘memcmp’ was not declared in this scope
if( !memcmp(magic,ANALYZE_LE_MAGIC,4) ||
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h: In function ‘int writeAnalyze(char*, _image*)’:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:222:21: error: ‘strlen’ was not declared in this scope
length=strlen(name);
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:225:42: error: ‘strncmp’ was not declared in this scope
if ( strncmp( name+length-4, ".hdr", 4 ) == 0 ) {
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:238:47: error: ‘strncpy’ was not declared in this scope
strncpy( outputName, name, length-extLength );
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:239:45: error: ‘strncmp’ was not declared in this scope
if ( strncmp( name+length-7, ".hdr.gz", 7 ) == 0 )
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:240:52: error: ‘strcpy’ was not declared in this scope
strcpy( outputName+length-extLength, ".hdr.gz" );
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:242:49: error: ‘strcpy’ was not declared in this scope
strcpy( outputName+length-extLength, ".hdr" );
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:265:41: error: ‘strncmp’ was not declared in this scope
if ( strncmp( name+length-3, ".gz", 3 ) == 0 ) {
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:266:52: error: ‘strcpy’ was not declared in this scope
strcpy( outputName+length-extLength, ".img.gz" );
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:269:49: error: ‘strcpy’ was not declared in this scope
strcpy( outputName+length-extLength, ".img" );
^
In file included from /home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze.cpp:25:0,
from /home/ren/Compile/CGAL/cgal/build/Debug/Installation/src/CGAL_ImageIO/all_files.cpp:1:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h: In function ‘int _readAnalyzeHeader(_image*, const char*, dsr*)’:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:470:101: error: ‘strlen’ was not declared in this scope
im->user[i] = (char *) ImageIO_alloc((strlen("Data lost in the Analyze -> ImageIO conversion:") + 1));
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:532:36: error: ‘strcmp’ was not declared in this scope
if( strcmp( name+length-4, ".hdr" ) )
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:542:27: error: ‘strcpy’ was not declared in this scope
strcpy(data_filename,name);
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h: In function ‘int writeAnalyzeHeader(const _image*)’:
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:598:37: error: ‘memset’ was not declared in this scope
memset(&hdr,0, sizeof(struct dsr));
^
/home/ren/Compile/CGAL/cgal/CGAL_ImageIO/src/CGAL_ImageIO/analyze_impl.h:763:36: error: ‘strcpy’ was not declared in this scope
strcpy(hdr.dime.vox_units,"mm.");
^
make[2]: *** [Installation/src/CGAL_ImageIO/CMakeFiles/CGAL_ImageIO.dir/all_files.cpp.o] Error 1
make[1]: *** [Installation/src/CGAL_ImageIO/CMakeFiles/CGAL_ImageIO.dir/all] Error 2
This is a strange error (CGAL is tested on your version of Ubuntu and we never saw it).
Can you try to compile again after adding #include <string.h> at the beginning of the file analyze_impl.h?
Thanks @sgiraudot as adding the #include <string.h> as suggested fixes the issue. This is my system (Ubuntu 14.04):
-- CGAL_VERSION is 4.8-I-900
-- CGAL_VERSION_NR is 1040800900
-- CGAL_GIT_HASH is e211843b4f81b47c0028734fac64363d6a11f051
-- CGAL_CREATED_SVN_REVISION is 99999 (dummy)
-- CGAL_MAJOR_VERSION=4
-- CGAL_MINOR_VERSION=8
-- CGAL_BUGFIX_VERSION=0
-- CGAL_BUILD_VERSION=900
-- CGAL_SONAME_VERSION=11
-- CGAL_SOVERSION =11.0.1
-- CGAL_REFERENCE_CACHE_DIR=
-- Building shared libraries
-- Targetting Unix Makefiles
-- Using /usr/bin/c++ compiler.
-- USING CMake version: 2.8.12
-- System: Linux
-- USING GCC_VERSION = '4.9.3'
-- Using gcc version 4 or later. Adding -frounding-math
Fixed in 9fceea2