Home Help Center

how to use ICE in VC6.0??

leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
always occur "Only multi-threaded DLL libraries can be used with Ice" error ??

I builded an ATL com project and have added include path/lib path(ice3.2.1 for VC6.0 had installed)

What I have done something wrong?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    It looks like you're using the wrong compiler settings to compile your application (most likely /ML or /MLd). You need to use the /MD or /MDd compiler option to compile Ice applications, see here for more information on these options.

    Cheers,
    Benoit.
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    have resolved
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    thanks for replying
    but occur new problem...

    d:\ice-3.2.1-vc60\include\stlport\stl\debug\_vector.h(277) : error C2953: 'vector' : template class has already been defined


    how can I use "MS STL" and stlport lib at the same time( in ATL com project)?
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    d:\ice-3.2.1-vc60\include\stlport\stl\debug\_debug.h(166) : warning C4005: '_STLP_DEBUG_CHECK' : macro redefinition
    d:\ice-3.2.1-vc60\include\stlport\stl\_config.h(375) : see previous definition of '_STLP_DEBUG_CHECK'
    d:\ice-3.2.1-vc60\include\stlport\stl\debug\_debug.h(167) : warning C4005: '_STLP_DEBUG_DO' : macro redefinition
    d:\ice-3.2.1-vc60\include\stlport\stl\_config.h(376) : see previous definition of '_STLP_DEBUG_DO'
    d:\ice-3.2.1-vc60\include\stlport\stl\debug\_vector.h(277) : error C2953: 'vector' : template class has already been defined
    d:\ice-3.2.1-vc60\include\stlport\stl\debug\_vector.h(277) : see declaration of 'vector'
    d:\ice-3.2.1-vc60\include\ice\proxy.h(492) : error C2027: use of undefined type 'Object'
    d:\ice-3.2.1-vc60\include\ice\objectf.h(19) : see declaration of 'Object'
    d:\ice-3.2.1-vc60\include\ice\proxy.h(492) : error C2039: 'ice_facet' : is not a member of 'ProxyHandle<class Ice::Object>'
    d:\ice-3.2.1-vc60\include\ice\localexception.h(601) : error C2079: 'badMagic' uses undefined class 'vector<unsigned char,class _STL::allocator<unsigned char> >'
    Error executing cl.exe.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You need to move the stlport include directory to the top of the list of includes directories in the Visual Studio options (in the IDE, choose Tools->Options->Directories and select "Include files"). This is necessary so that the compiler uses the STL headers from the STLport library instead of the Visual C++ STL library.

    You might also want to check the settings of the demo/Ice/MFC projects, it might help for your ATL project.

    Cheers,
    Benoit.
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    have resolved,thanks for your help
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    new problem
    ...................................................................................
    ice file

    module UVSPClient
    {
    struct USERINFO
    {
    string realname;
    string account;
    string nickname;
    string UUID;
    };
    interface ClickObject
    {
    nonmutating bool isClicked();
    nonmutating USERINFO getUserInfo();
    bool isExist(string Account);
    bool register(UVSP::Platform::RegisterInfo RegInfo);
    int Validate(string Account,string Pwd);
    };
    };

    ..................................................................................
    ValidateClient.h

    // ValidateClient.h: interface for the CValidateClient class.
    //
    //////////////////////////////////////////////////////////////////////

    #if !defined(AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_)
    #define AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000

    class CValidateClient : public UVSPClient::ClickObject
    {

    public:
    CValidateClient();
    virtual ~CValidateClient();
    public:
    static CValidateClient* getValidateClient();

    virtual bool isClicked(const ::Ice::Current* current);

    virtual ::UVSPClient::USERINFO getUserInfo(const ::Ice::Current* current);

    virtual bool isExist(const ::std::string& Account, const ::Ice::Current* current);

    virtual bool _cpp_register(const ::UVSP::Platform::RegisterInfo& RegInfo, const ::Ice::Current* current);

    virtual ::Ice::Int Validate(const ::std::string& Account, const ::std::string& pwd, const ::Ice::Current* current);


    private:
    static CValidateClient* _pthis;
    };

    #endif // !defined(AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_)

    ..........................................................................................
    .cpp

    // ValidateClient.cpp: implementation of the CValidateClient class.
    //
    //////////////////////////////////////////////////////////////////////

    #include "stdafx.h"
    #include "ValidateClient.h"

    //////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////
    CValidateClient* CValidateClient::_pthis = NULL;

    CValidateClient::CValidateClient()
    {

    }

    CValidateClient::~CValidateClient()
    {

    }

    CValidateClient* CValidateClient::getValidateClient()
    {
    if(_pthis == NULL)
    // _pthis = new CValidateClient();

    return _pthis;
    }

    bool CValidateClient::isClicked(const ::Ice::Current* current)
    {
    return true;
    }
    UVSPClient::USERINFO CValidateClient::getUserInfo(const ::Ice::Current* current)
    {
    UVSPClient::USERINFO ui;
    return ui;
    }
    bool CValidateClient::isExist(const ::std::string& Account, const ::Ice::Current* current)
    {
    return true;
    }
    bool CValidateClient::_cpp_register(const ::UVSP::Platform::RegisterInfo& RegInfo, const ::Ice::Current* current)
    {
    return true;
    }
    Ice::Int CValidateClient::Validate(const ::std::string& Account, const ::std::string& pwd, const ::Ice::Current* current)
    {
    return 0;
    }

    .............................................

    Compiling...
    ValidateClient.cpp
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : error C2259: 'CValidateClient' : cannot instantiate abstract class due to following members:
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.h(12) : see declaration of 'CValidateClient'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isClicked(const struct Ice::Current &) const' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(325) : see declaration of 'isClicked'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'struct UVSPClient::USERINFO __thiscall UVSPClient::ClickObject::getUserInfo(const struct Ice::Current &) const' : pure virtual function wa
    s not defined
    .\ice cpp file\UVSPClickObjectC.h(328) : see declaration of 'getUserInfo'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isExist(const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<c
    har> > &,const struct Ice::Current &)' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(331) : see declaration of 'isExist'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::_cpp_register(const struct UVSP::Platform::RegisterInfo &,const struct Ice::Current &)' : pure vi
    rtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(334) : see declaration of '_cpp_register'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'int __thiscall UVSPClient::ClickObject::Validate(const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<c
    har> > &,const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > &,const struct Ice::Current &)' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(337) : see declaration of 'Validate'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : error C2259: 'CValidateClient' : cannot instantiate abstract class due to following members:
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.h(12) : see declaration of 'CValidateClient'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isClicked(const struct Ice::Current &) const' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(325) : see declaration of 'isClicked'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'struct UVSPClient::USERINFO __thiscall UVSPClient::ClickObject::getUserInfo(const struct Ice::Current &) const' : pure virtual function wa
    s not defined
    .\ice cpp file\UVSPClickObjectC.h(328) : see declaration of 'getUserInfo'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isExist(const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<c
    har> > &,const struct Ice::Current &)' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(331) : see declaration of 'isExist'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::_cpp_register(const struct UVSP::Platform::RegisterInfo &,const struct Ice::Current &)' : pure vi
    rtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(334) : see declaration of '_cpp_register'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'int __thiscall UVSPClient::ClickObject::Validate(const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<c
    har> > &,const class _STL::basic_string<char,class _STL::char_traits<char>,class _STL::allocator<char> > &,const struct Ice::Current &)' : pure virtual function was not defined
    .\ice cpp file\UVSPClickObjectC.h(337) : see declaration of 'Validate'
    Error executing cl.exe.

    UVSP CLib.dll - 2 error(s), 10 warning(s)



    ...................................................
    what 's wrong???
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Check the declaration of the methods in UVSPClickObjectC.h, you'll see that they don't match the declaration of the methods in your class defined in ValidateClient.h. Specifically, const ::Ice::Current* current should be const ::Ice::Current& current.

    Cheers,
    Benoit.
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    I have corrected from "const Ice::Current*" to "const Ice::Current&",but the problem also exist!
    .................................................................
    ice file

    module UVSPClient
    {
    struct USERINFO
    {
    string realname;
    string account;
    string nickname;
    string UUID;
    };
    interface ClickObject
    {
    nonmutating bool isClicked();
    nonmutating USERINFO getUserInfo();
    bool isExist(string Account);
    bool Register(UVSP::Platform::RegisterInfo RegInfo);
    int Validate(string Account,string Pwd);
    };
    };

    ................................................................
    .h file

    // ValidateClient.h: interface for the CValidateClient class.
    //
    //////////////////////////////////////////////////////////////////////

    #if !defined(AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_)
    #define AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_

    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000

    class CValidateClient : public UVSPClient::ClickObject
    {

    public:
    CValidateClient();
    virtual ~CValidateClient();
    public:
    static CValidateClient* getValidateClient();

    public:
    virtual bool isClicked(const ::Ice::Current& current);

    virtual ::UVSPClient::USERINFO getUserInfo(const ::Ice::Current& current);

    virtual bool isExist(const ::std::string& Account, const ::Ice::Current& current);

    virtual bool Register(const ::UVSP::Platform::RegisterInfo& RegInfo, const ::Ice::Current& current);

    virtual ::Ice::Int Validate(const ::std::string& Account, const ::std::string& pwd, const ::Ice::Current& current);


    private:
    static CValidateClient* _pthis;
    };

    #endif // !defined(AFX_VALIDATECLIENT_H__980078BD_40E6_4661_AEF8_327A3702476A__INCLUDED_)

    ....................................................................
    .cpp file

    // ValidateClient.cpp: implementation of the CValidateClient class.
    //
    //////////////////////////////////////////////////////////////////////

    #include "stdafx.h"
    #include "ValidateClient.h"

    //////////////////////////////////////////////////////////////////////
    // Construction/Destruction
    //////////////////////////////////////////////////////////////////////
    CValidateClient* CValidateClient::_pthis = NULL;

    CValidateClient::CValidateClient()
    {

    }

    CValidateClient::~CValidateClient()
    {

    }

    CValidateClient* CValidateClient::getValidateClient()
    {
    if(_pthis == NULL)
    _pthis = new CValidateClient();

    return _pthis;
    }

    bool CValidateClient::isClicked(const ::Ice::Current& current)
    {
    return true;
    }
    UVSPClient::USERINFO CValidateClient::getUserInfo(const ::Ice::Current& current)
    {
    UVSPClient::USERINFO ui;
    return ui;
    }
    bool CValidateClient::isExist(const ::std::string& Account, const ::Ice::Current& current)
    {
    return true;
    }
    bool CValidateClient::Register(const ::UVSP::Platform::RegisterInfo& RegInfo, const ::Ice::Current& current)
    {
    return true;
    }
    Ice::Int CValidateClient::Validate(const ::std::string& Account, const ::std::string& pwd, const ::Ice::Current& current)
    {
    return 0;
    }

    .......................................................................
    Compiling...
    ValidateClient.cpp
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : error C2259: 'CValidateClient' : cannot instantiate abstract class due to following members:
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\validateclient.h(12) : see declaration of 'CValidateClient'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isClicked(const struct Ice::Current &) const' : pure virtual function was not defined
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\ice cpp file\uvspclickobjectc.h(325) : see declaration of 'isClicked'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'struct UVSPClient::USERINFO __thiscall UVSPClient::ClickObject::getUserInfo(const struct Ice::Current &) const' : pure virtual function wa
    s not defined
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\ice cpp file\uvspclickobjectc.h(328) : see declaration of 'getUserInfo'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : error C2259: 'CValidateClient' : cannot instantiate abstract class due to following members:
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\validateclient.h(12) : see declaration of 'CValidateClient'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'bool __thiscall UVSPClient::ClickObject::isClicked(const struct Ice::Current &) const' : pure virtual function was not defined
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\ice cpp file\uvspclickobjectc.h(325) : see declaration of 'isClicked'
    E:\ffcs之旅\DCE project\5_RD\3_MK\UVSP源码\Client Class Lib\UVSP CLib\ValidateClient.cpp(26) : warning C4259: 'struct UVSPClient::USERINFO __thiscall UVSPClient::ClickObject::getUserInfo(const struct Ice::Current &) const' : pure virtual function wa
    s not defined
    e:\ffcs之旅\dce project\5_rd\3_mk\uvsp源码\client class lib\uvsp clib\ice cpp file\uvspclickobjectc.h(328) : see declaration of 'getUserInfo'
    Error executing cl.exe.

    UVSP CLib.dll - 2 error(s), 4 warning(s)


    ??????????????????????????????????
    what 's wrong?:(
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    The declaration of your methods doesn't match the one from UVSPClient::ClickObject defined in the uvspclickobjectc.h header. You should open this header file and check the lines given by the compiler to see the expected declaration (line 325 and 328).

    Most likely, the problem is caused by a missing "const" at the end of the method declaration since you've declared the methods as "nonmutating".

    Btw, you shouldn't use the "nonmutating" keyword: it has been deprecated. Instead you should use "idempotent" and ["cpp:const"], for example:
    // Slice
    ["cpp:const"] idempotent bool isClicked();
    

    Cheers,
    Benoit.
  • leoleo Member leo wangOrganization: SuperMap.incProject: DGIS
    heve resolved,
    thank you very much for help!
Sign In or Register to comment.