Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-12-09T17:46:59Z by AlexFleischer
Broncho
Broncho
1 Post
ACCEPTED ANSWER

Pinned topic C++ IloException linking problem

‏2013-12-09T16:32:58Z |

Hi All,

I write the codes like that:

try {.......}

catch (IloException& ex) {
      //cerr << "Error: " << ex << endl;
cerr<<ex.getMessage()<<endl;
 
   }
   catch (...) {
      cerr << "Error" << endl;
   }

But when I build solution, two errors come up. They are:

error LNK1120: 1 unresolved externals
error LNK2001: unresolved external symbol "public: virtual void __thiscall IloException::print(class std::basic_ofstream<char,struct std::char_traits<char> > &)const " (?print@IloException@@UBEXAAV?$basic_ofstream@DU?$char_traits@D@std@@@std@@@Z)

The relevant class can be found in ilosys.h. It says:

class ILO_EXPORTED IloException : public IloQuietException { // here because needed by threads
public:
IloException(const IloException&);
~IloException();
IloException& operator=(const IloException&);
 
virtual const char* getMessage() const;
virtual void print(ILOSTD(ofstream)& out) const;
 
virtual void end();
protected:
 
IloException(const char* message = 0, IloBool deleteMessage=IloFalse);
};

But I don't know whether it has problem. 

I used VS2010 to program. When I follow the settings of C++ project, I did exactly the same as the steps on...\ILOG\CPLEX_Studio1251\cplex\c_cpp.html. Thus, I don't know how these two errors come.

Does anyone know the reason? Thank you very much!