Archived

This forum has been archived. Please start a new discussion on GitHub.

Vc++ 8.0

IDE:Visual C++ 8.0
version:2.1.2
Symptom: Compile Error(C2299) in handle.h

handle.h
#ifdef _WIN32 // COMPILERBUG: Is VC++ or GNU C++ right here???
    template<>
    Handle(const Handle<T>& r)   // C2299
#else
    Handle(const Handle& r)
#endif
    {
	this->_ptr = r._ptr;

	if(this->_ptr)
	{
	    this->_ptr->__incRef();
    }

error C2299: 'IceUtil::Handle<T>::Handle' :
behavior change: an explicit specialization cannot be a copy constructor or copy assignment operator
d:\program files\开发环境\ice2.1.2\include\iceutil\handle.h 141

some information I found in MSDN:
"This error can also be generated as a result of compiler conformance work that was done for Visual C++ 2005: previous versions of Visual C++ allowed explicit specializations for a copy constructor or a copy assignment operator.

To resolve C2299, do not make the copy constructor or assignment operator a template function, but rather a non-template function that takes a class type. Any code that calls the copy constructor or assignment operator by explicitly specifying the template arguments needs to remove the template arguments."

And more:
"Breaking Changes in the Visual C++ 2005 Compiler
Explicit specialization not allowed as a copy constructor/copy assignment operator
Code that depends on an explicit template specialization for a copy constructor or copy assignment operator will now get Compiler Error C2299. Standard C++ prohibits this. This change was made for conformance reasons, to make code more portable.
"

Comments

  • Note that Visual C++ 8 is not a supported compiler for Ice 2.1.2.

    If you download Ice 3.0, you will find that this problem has been rectified.

    Cheers,

    Michi.
  • hi, michi,
    I have tried the 3.0 in vc8.0 and the source codes can be compiled well but the link configuration is not set correctly and brings many errors. Actually, it seems due to the visual studio project conversion problem when I built the downloaded source codes without any modifications. In vc7.1, everything is OK.
    Hope a vc-8.0 compatible version will soon be provided in download page.

    Thanks for your excellent Ice ,which makes many things cool.




    Best Regards
    OrNot
  • I did a clean build of Ice for C++ with Visual Studio 8 before we shipped Ice 3.0. The trick to get the conversion done without errors is as follows:

    Unpack the source distribution and build it with Visual Studio 7. (This is really just to get all the Slice files processed by slice2cpp, so none of the generated source files are missing.) Then shut down VS 7 and start VS 8. Use the conversion wizard that opens when you open the All.sln file. The conversion to VS 8 project files then proceeds without errors.

    Thereafter, I had no problems getting Ice to build with VS 8, and all the tests passed. To get things to compile and link correctly, you have to set up your VS 8 directory information though, so VS 8 can find the Ice include files, executables, and libraries. Did you maybe forget that last step?

    Cheers,

    Michi.
  • hi,michi,
    I tried to compile the source codes with vc8.0 following your steps.
    1) First compile them with vc7.1, everything is ok
    2) Close vc7.1 ,open vc 8.0 and set the Ice include files, executables, and libraries. Now start to build all .
    However some errors occur :

    Assertion Failed!
    Program: slice2cpp.exe
    file: RecMutex.cpp
    line:27

    Expression: _count==0



    Then I tried to rebuild a single project helloc, failed too. Here is the blog:

    Build Log Rebuild started: Project: helloC, Configuration: Debug|Win32
    Command Lines Creating temporary file "d:\Ice-3.0.0\demo\Ice\hello\Debug\BAT00013528522928.bat" with contents
    [
    @echo off

    ..\..\..\bin\slice2cpp.exe Hello.ice



    if errorlevel 1 goto VCReportError

    goto VCEnd

    :VCReportError

    echo Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"

    exit 1

    :VCEnd
    ]
    Creating command line """d:\Ice-3.0.0\demo\Ice\hello\Debug\BAT00013528522928.bat"""
    Output Window Performing Custom Build Step
    Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
    Results Build log was saved at "file://d:\Ice-3.0.0\demo\Ice\hello\Debug\BuildLog.htm"
    helloC - 1 error(s), 0 warning(s)


    BTW: in the install.windows, I notice a piece of advice that third part souce codes should be recomplied in vc8.0. I once tried but failed. Now in your step, it seems to use the binaries produced by vc7.1, is it ok?

    Thanks alot
    OrNOt
  • Ah, I forgot to mention. After the conversion, before you kick off the build with VS 8, you need to clean the solution. I had no problems compiling against the binary third-party packages with VS 8, but you must compile in release mode, I believe.

    Cheers,

    Michi.
  • sorry, Michi, I still can not get a clean build . There are more or less errors.:( . Maybe I need to change a computer to try again .

    Anyway, Thank you very much.
  • bernard
    bernard Jupiter, FL
    Visual Studio .NET 2005 support

    The next Ice release will provide better support for Visual Studio 2005; for 3.0, we had too little time between the VS2005 release and our own release.

    If you want to build Ice with VS2005, the first step is to build all third-party packages (Berkeley DB, Bzip2, Expat and OpenSSL) with VS2005. In particular you need to:
    - build Berkeley DB and Bzip2 is both debug and release configurations
    - manually embed the VS2005-generated manifest file in various binaries.
    E.g.:
    C:\Ice-ThirdParty-VC80-x86\bin>mt.exe -manifest openssl.exe.manifest -outputresource:openssl.exe;1
    C:\Ice-ThirdParty-VC80-x86\bin>mt.exe -manifest ssleay32.dll.manifest -outputresource:ssleay32.dll;2
    C:\Ice-ThirdParty-VC80-x86\bin>mt.exe -manifest libeay32.dll.manifest -outputresource:libeay32.dll;2
    C:\Ice-ThirdParty-VC80-x86\bin>mt.exe -manifest bzip2.dll.manifest -outputresource:bzip2.dll;2
    C:\Ice-ThirdParty-VC80-x86\bin>mt.exe -manifest bzip2d.dll.manifest -outputresource:bzip2d.dll;2
    

    Also, there is no need to go through an intermediary VC71 update. You can directly convert the Ice project files (in Visual Studio 6 format) to the Visual Studio 2005 format.

    Once properly built, Ice is fully supported with VS2005; in particular if you run the Ice test suite, all tests are expected to succeed.

    Best regards,
    Bernard