Home Help Center

how to config the environment in VC .NET 2003

I am a novice . i work in VC .NET 2003.

now!
i have added "D:\ice1.5.1for 7.0\include" into the directiories for include files
and added "D:\ice1.5.1for 7.0\lib" into the directiories for lib files.


but what i could do is compiling . i can't link the files.

the error messages :


icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall IceUtil::NullHandleException::NullHandleException(char const *,int)" ([email protected]@@[email protected]@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::NoObjectFactoryException::~NoObjectFactoryException(void)" ([email protected]@@[email protected])

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::Object::~Object(void)" ([email protected]@@[email protected])

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::OperationNotExistException::~OperationNotExistException(void)" ([email protected]@@[email protected])

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall IceDelegate::Ice::Object::~Object(void)" ([email protected]@[email protected]@[email protected])

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class Ice::Object *)" ([email protected]@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall IceUtil::GCShared::~GCShared(void)" ([email protected]@@[email protected])

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class Ice::ObjectAdapter *)" ([email protected]@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class IceProxy::Ice::Object *)" ([email protected]@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::incRef(class Ice::Object *)" ([email protected]@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::LocalException::LocalException(class Ice::LocalException const &)" ([email protected]@@[email protected]@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::MarshalException::MarshalException(class Ice::MarshalException const &)" ([email protected]@@[email protected]@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::NoObjectFactoryException::NoObjectFactoryException(class Ice::NoObjectFactoryException const &)" ([email protected]@@[email protected]@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::OperationNotExistException::OperationNotExistException(class Ice::OperationNotExistException const &)" ([email protected]@

~~~


the source files are copies from the instructions .


//////////////////////////////////////////////////////////////////////////////////////////////
//Printer.cpp
//////////////////////////////////////////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////////////////////////////////////////
///server.cpp
///////////////////////////////////////////////////////////////////////////////////////////////

#include "Printer.h"
using namespace std;
class PrinterI : public Printer {
public:
virtual void printString(const string & s,const Ice::Current &);
};
void
PrinterI::
printString(const string & s, const Ice::Current &)
{
cout << s << endl;
}
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints(
"SimplePrinterAdapter", "default -p 10000");
Ice::ObjectPtr object = new PrinterI;
adapter->add(object,
Ice::stringToIdentity("SimplePrinter"));
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception & e) {
cerr << e << endl;
status = 1;
} catch (const char * msg) {
cerr << msg << endl;
status = 1;
}
if (ic)
ic->destroy();
return status;
}



//////////////////////////////////////////////////////////////////////////////////////////////
//Printer.h
//////////////////////////////////////////////////////////////////////////////////////////////


// Ice version 1.5.1
// Generated from file `Printer.ice'

#ifndef __Printer_h__
#define __Printer_h__

#include <Ice/LocalObjectF.h>
#include <Ice/ProxyF.h>
#include <Ice/ObjectF.h>
#include <Ice/Exception.h>
#include <Ice/LocalObject.h>
#include <Ice/Proxy.h>
#include <Ice/Object.h>
#include <Ice/Outgoing.h>
#include <Ice/Incoming.h>
#include <Ice/Direct.h>

#ifndef ICE_IGNORE_VERSION
# if ICE_INT_VERSION != 10501
# error Ice version mismatch!
# endif
#endif

namespace IceProxy
{

class Printer;
bool operator==(const Printer&, const Printer&);
bool operator!=(const Printer&, const Printer&);
bool operator<(const Printer&, const Printer&);

}

class Printer;
bool operator==(const Printer&, const Printer&);
bool operator!=(const Printer&, const Printer&);
bool operator<(const Printer&, const Printer&);

namespace IceInternal
{

void incRef(::Printer*);
void decRef(::Printer*);

void incRef(::IceProxy::Printer*);
void decRef(::IceProxy::Printer*);

}

typedef ::IceInternal::Handle< ::Printer> PrinterPtr;
typedef ::IceInternal::ProxyHandle< ::IceProxy::Printer> PrinterPrx;

void __write(::IceInternal::BasicStream*, const PrinterPrx&);
void __read(::IceInternal::BasicStream*, PrinterPrx&);
void __write(::IceInternal::BasicStream*, const PrinterPtr&);
void __read(::IceInternal::BasicStream*, PrinterPtr&);
void __patch__PrinterPtr(void*, ::Ice::ObjectPtr&);

namespace IceProxy
{

class Printer : virtual public ::IceProxy::Ice::Object
{
public:

void printString(const ::std::string&);
void printString(const ::std::string&, const ::Ice::Context&);

static const ::std::string& ice_staticId();

private:

virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object> __createDelegateM();
virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object> __createDelegateD();
};

}

namespace IceDelegate
{

class Printer : virtual public ::IceDelegate::Ice::Object
{
public:

virtual void printString(const ::std::string&, const ::Ice::Context&) = 0;
};

}

namespace IceDelegateM
{

class Printer : virtual public ::IceDelegate::Printer,
virtual public ::IceDelegateM::Ice::Object
{
public:

virtual void printString(const ::std::string&, const ::Ice::Context&);
};

}

namespace IceDelegateD
{

class Printer : virtual public ::IceDelegate::Printer,
virtual public ::IceDelegateD::Ice::Object
{
public:

virtual void printString(const ::std::string&, const ::Ice::Context&);
};

}

class Printer : virtual public ::Ice::Object
{
public:

static const ::std::string __ids[2];
virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) const;
virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::Current()) const;
virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::Current()) const;
static const ::std::string& ice_staticId();

virtual void printString(const ::std::string&, const ::Ice::Current& = ::Ice::Current()) = 0;
::IceInternal::DispatchStatus ___printString(::IceInternal::Incoming&, const ::Ice::Current&);

static ::std::string __all[5];
virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming&, const ::Ice::Current&);

virtual void __write(::IceInternal::BasicStream*) const;
virtual void __read(::IceInternal::BasicStream*, bool);
};

void __patch__PrinterPtr(void*, ::Ice::ObjectPtr&);

#endif

Comments

  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Re: how to config the environment in VC .NET 2003
    Originally posted by fw_csha
    i have added "D:\ice1.5.1for 7.0\include" into the directiories for include files
    and added "D:\ice1.5.1for 7.0\lib" into the directiories for lib files.

    modifying the environment of VS is not sufficient. You will also have to adjust some settings for your project.

    Did you link in ice.lib and iceUtil.lib (which contain the symbols that weren't found)?

    If not, do this:
    1. Press right mouse button on the project node in the project explorer in VS
    2. Select properties
    3. In the properties dialog, open the linker branch (click on it)
    4. select input (I hope it's correct as I'm using a non-english version here!)
    5. under additional dependencies (first item), add 'ice.lib iceUtil.lib'
    6. Compile/ Link again your application

    These error messages should not appear any more.
  • fw_cshafw_csha Member
    3Q~~

    success~~
    :D

    ps:
    how to deal with the problem that can't find the iceutil15.dll when i run the *.exe .

    must i have to put all .dll files into the same direction of .exe?

    or there is another good method to solve the problem ?
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    must i have to put all .dll files into the same direction of .exe?

    or there is another good method to solve the problem ?

    as usual, there are two options:
    1. The good one is to add an environmnent variable called ICEDIR which points into e.g. c:\ice-1.5.1 and then to adjust the PATH variable to PATH=%PATH%;%ICEDIR%\bin
    2. the easier one is to copy the dlls into e.g. your system directory
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    When you distribute an application, it is recommended to put the DLLs in the same directory as the exe. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/load_time_dynamic_linking.asp.

    This is particularly important if you use IceSSL, since the Intel PRO/Wireless (centrino) software installs old versions of the OpenSSL DLLs in the system32 directory.

    Cheers,
    Bernard
  • stephanstephan Member Stephan StapelOrganization: Stephan StapelProject: BristolNG
    Originally posted by bernard
    When you distribute an application, it is recommended to put the DLLs in the same directory as the exe.

    Sorry, this is true for most cases, but it doesn't work for Windows services as their 'current directory' is not the install directory but rather the system directory!

    regs,

    Stephan
Sign In or Register to comment.