ERRORs would not let to build configure.exe with VS 2005

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
97a+
Posts: 3
Joined: 2013-12-30T08:40:09-07:00
Authentication code: 6789

ERRORs would not let to build configure.exe with VS 2005

Post by 97a+ »

ImageMagick version: 6.8.8-1

This was not an issue before the version above.

After conversion project with Visual Studio 2005, the following ERRORs that would not let to build configure.exe occur (note that not the warnings are the issue):

Code: Select all

Build started: Project: configure, Configuration: Release|Win32

Creating temporary file "e:\ImageMagick-6.8.8\VisualMagick\configure\Release\configure\RSP00000840124040.rsp" with contents
[
/O2 /Ob1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_VC80_UPGRADE=0x0700" /D "_AFXDLL" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Fp".\Release\configure/configure.pch" /Fo".\Release\configure/" /Fd".\Release\configure/" /W3 /c /TP  /Zm200

".\welcome_page.cpp"

".\WaitDlg.cpp"

".\target_page.cpp"

".\system_page.cpp"

".\finished_page.cpp"

".\configure_wizard.cpp"

".\configure.cpp"
]
Creating command line "cl.exe @"e:\ImageMagick-6.8.8\VisualMagick\configure\Release\configure\RSP00000840124040.rsp" /nologo /errorReport:prompt"
Creating temporary file "e:\ImageMagick-6.8.8\VisualMagick\configure\Release\configure\RSP00000940124040.rsp" with contents
[
/O2 /Ob1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_VC80_UPGRADE=0x0700" /D "_AFXDLL" /D "_MBCS" /GF /FD /EHsc /MD /Gy /Yc"stdafx.h" /Fp".\Release\configure/configure.pch" /Fo".\Release\configure/" /Fd".\Release\configure/" /W3 /c /TP  /Zm200

".\stdafx.cpp"
]
Creating command line "cl.exe @"e:\ImageMagick-6.8.8\VisualMagick\configure\Release\configure\RSP00000940124040.rsp" /nologo /errorReport:prompt"


Compiling...
stdafx.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Compiling...
welcome_page.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
WaitDlg.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
target_page.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
system_page.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
finished_page.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
configure_wizard.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
configure.cpp
 WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
.\configure.cpp(217) : warning C4996: 'strcpy' was declared deprecated
        C:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(73) : see declaration of 'strcpy'
        Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
.\configure.cpp(218) : warning C4996: '_tcslwr' was declared deprecated
        C:\Program Files\Microsoft Visual Studio 8\VC\include\tchar.h(1785) : see declaration of '_tcslwr'
        Message: 'This function or variable may be unsafe. Consider using _tcslwr_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
.\configure.cpp(268) : warning C4996: 'vsprintf' was declared deprecated
        C:\Program Files\Microsoft Visual Studio 8\VC\include\stdio.h(345) : see declaration of 'vsprintf'
        Message: 'This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
.\configure.cpp(672) : error C2664: 'std::basic_ifstream<_Elem,_Traits>::basic_ifstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::string' to 'const char *'
        with
        [
            _Elem=char,
            _Traits=std::char_traits
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
.\configure.cpp(724) : error C2664: 'std::basic_ofstream<_Elem,_Traits>::basic_ofstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::string' to 'const char *'
        with
        [
            _Elem=char,
            _Traits=std::char_traits
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Generating Code...
Build fails after "Generating Code".
The two errors above makes impossible to build configure.exe

Surely enough, developer was warned after the project has been converted:

Code: Select all

configure.vcproj Converted Errors=0 Warnings=2 

Conversion Issues - configure.vcproj: 

Visual C++ now supports a secure version of the C Runtime Library. Use of this library is turned on by default. You may see some warnings about deprecated functions when you build your project. It is advised that you correct these warnings, in order to make your code more secure. 

The C/C++ compiler default settings have been modified to be more compliant with ISO Standard C++. Included in those changes are enforcing Standard C++ for loop scoping and supporting wchar_t as a native type. These changes may cause existing code to no longer compile without changes to the code or the compiler options with which it is built. 

Project file successfully backed up as 'E:\ImageMagick-6.8.8\VisualMagick\configure\configure.vcproj.7.00.old'. 

Project upgraded successfully. 

Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are automatically excluded from building with the Manifest Tool. It is recommended that the dependency information contained in any manifest files be converted to "#pragma comment(linker,"<insert dependency here>")" in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line will need to be commented out before the project will build correctly. 

Due to a conformance change in the C++ compiler, code change may be required before your project will build without errors. Previous versions of the C++ compiler allowed specification of member function pointers by member function name (e.g. MemberFunctionName). The C++ standard requires a fully qualified name with the use of the address-of operator (e.g. &ClassName::MemberFunctionName). If your project contains forms or controls used in the Windows Forms Designer, you may have to change code in InitializeComponent because the designer generated code used the non-conformant syntax in delegate construction (used in event handlers).  
Before building the code, appropriate changes need to be done. Sounds buggy.

The following newly added block of code to the Version 6.8.8-1 contains the errors:

Code: Select all

/*Line 666:*/ void CConfigureApp::replace_keywords(std::string fileName)
{
  string
    line,
    str;

 /*Line 672*/ ifstream infile(fileName, ifstream::in | ifstream::binary);
  if (infile.is_open())
    {
      while (getline(infile,line))
      {
        if (!line.empty() && *line.rbegin() == '\r')
          line.erase(line.length()-1,1);

        if (line == "$$DEPRECATED")
          {
            if (excludeDeprecated)
              line="#define MAGICKCORE_EXCLUDE_DEPRECATED";
            else
              line="#undef MAGICKCORE_EXCLUDE_DEPRECATED";
          }
        else if (line == "$$DEPTH")
          {
            if (quantumDepth == Q8)
              line="#define MAGICKCORE_QUANTUM_DEPTH 8";
            else if (quantumDepth == Q16)
              line="#define MAGICKCORE_QUANTUM_DEPTH 16";
            else if (quantumDepth == Q32)
              line="#define MAGICKCORE_QUANTUM_DEPTH 32";
            else if (quantumDepth == Q64)
              line="#define MAGICKCORE_QUANTUM_DEPTH 64";
          }
        else if (line == "$$HDRI")
          {
            if (hdri)
              line="#define MAGICKCORE_HDRI_ENABLE 1";
            else
              line="#define MAGICKCORE_HDRI_ENABLE 0";
          }
        else if (line == "$$OPENCL")
          {
            if (with_opencl && openCL)
              line="#define MAGICKCORE__OPENCL\n#define MAGICKCORE_HAVE_CL_CL_H";
            else
              line="#undef MAGICKCORE__OPENCL\n#undef MAGICKCORE_HAVE_CL_CL_H";
          }
        else if (line == "$$X11")
          {
            if (X11Mode == X11_DISABLED)
              line="#undef MAGICKCORE_X11_DELEGATE";
            else
              line="#define MAGICKCORE_X11_DELEGATE";
          }
        str += line + "\n";
      }

      infile.close();

 /*Line 724*/     ofstream outfile(fileName, ofstream::out | ofstream::binary);
      if (outfile.is_open())
      {
        outfile << str;
        outfile.close();
      }
    }
}
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: ERRORs would not let to build configure.exe with VS 2005

Post by dlemstra »

The problem has been fixed, I did not receive an error or warning in VS2012.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
97a+
Posts: 3
Joined: 2013-12-30T08:40:09-07:00
Authentication code: 6789

Re: ERRORs would not let to build configure.exe with VS 2005

Post by 97a+ »

Confirmed. It appears that the issue remains for VS 2005. Builds with VS 2012.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: ERRORs would not let to build configure.exe with VS 2005

Post by dlemstra »

It will be fixed in the next release of ImageMagick (6.8.8-2).
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply