Archived

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

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)" (__imp_??0NullHandleException@IceUtil@@QAE@PBDH@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::NoObjectFactoryException::~NoObjectFactoryException(void)" (__imp_??1NoObjectFactoryException@Ice@@UAE@XZ)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::Object::~Object(void)" (__imp_??1Object@Ice@@UAE@XZ)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Ice::OperationNotExistException::~OperationNotExistException(void)" (__imp_??1OperationNotExistException@Ice@@UAE@XZ)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall IceDelegate::Ice::Object::~Object(void)" (__imp_??1Object@Ice@IceDelegate@@UAE@XZ)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class Ice::Object *)" (__imp_?decRef@IceInternal@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall IceUtil::GCShared::~GCShared(void)" (__imp_??1GCShared@IceUtil@@UAE@XZ)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class Ice::ObjectAdapter *)" (__imp_?decRef@IceInternal@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::decRef(class IceProxy::Ice::Object *)" (__imp_?decRef@IceInternal@@Z)

icetest error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl IceInternal::incRef(class Ice::Object *)" (__imp_?incRef@IceInternal@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::LocalException::LocalException(class Ice::LocalException const &)" (??0LocalException@Ice@@QAE@ABV01@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::MarshalException::MarshalException(class Ice::MarshalException const &)" (??0MarshalException@Ice@@QAE@ABV01@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::NoObjectFactoryException::NoObjectFactoryException(class Ice::NoObjectFactoryException const &)" (??0NoObjectFactoryException@Ice@@QAE@ABV01@@Z)

icetest error LNK2001: unresolved external symbol "public: __thiscall Ice::OperationNotExistException::OperationNotExistException(class Ice::OperationNotExistException const &)" (??0OperationNotExistException@Ice@

~~~


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

  • 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.
  • 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 ?
  • 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
  • bernard
    bernard Jupiter, FL
    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
  • 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