By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,386 Members | 1,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,386 IT Pros & Developers. It's quick & easy.

error LNK2019: unresolved external symbol - cl compiler

P: n/a
Hello,

I am trying to write a code to interface with ILOG OPL development
studio using their C++ libraries and header files. But I am encountering
linker issues, an example being -

error LNK2019: unresolved external symbol "public: void __thiscall
IloOplModelI::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &,long)"
(?printSolution@IloOplModelI@@QAEXAAV?$basic_ostre am@DU?$char_traits@D@std@@@std@@J@Z)
referenced in function "public: void __thiscall
IloOplModel::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &)"
(?printSolution@IloOplModel@@QAEXAAV?$basic_ostrea m@DU?$char_traits@D@std@@@std@@@Z)

Any idea why this is happening? Is this because OPL libraries are not
linked properly? If it is, how do I link the OPL library files using cl
in the command line? I am pretty new to using the cl compiler. Thanks in
advance.

Raj.
Oct 27 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
NewsGroup wrote:
I am trying to write a code to interface with ILOG OPL development
studio using their C++ libraries and header files. But I am encountering
linker issues, an example being -

error LNK2019: unresolved external symbol "public: void __thiscall
IloOplModelI::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &,long)"
(?printSolution@IloOplModelI@@QAEXAAV?$basic_ostre am@DU?$char_traits@D@std@@@std@@J@Z)
referenced in function "public: void __thiscall
IloOplModel::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &)"
(?printSolution@IloOplModel@@QAEXAAV?$basic_ostrea m@DU?$char_traits@D@std@@@std@@@Z)

Any idea why this is happening? Is this because OPL libraries are not
linked properly? If it is, how do I link the OPL library files using cl
in the command line? I am pretty new to using the cl compiler. Thanks in
advance.
This is not really a C++ *language* issue
(http://www.parashift.com/c++-faq-lit....html#faq-5.9), but a
tools and environment and/or third-party library issue. [OT]However, it
appears that IloOplModel::printSolution() does not appear in the files
supplied to the linker. I gather that this is a library class' member
function, not your own class' member function. Did you build the
library correctly? Has that function been deprecated or intentionally
omitted from the library? Have you supplied all necessary files to the
linker?[/OT]

For further help, you may want to ask in a forum dedicated to your
development tools or to the library.

Cheers! --M

Oct 27 '06 #2

P: n/a

mlimber wrote:
NewsGroup wrote:
I am trying to write a code to interface with ILOG OPL development
studio using their C++ libraries and header files. But I am encountering
linker issues, an example being -

error LNK2019: unresolved external symbol "public: void __thiscall
IloOplModelI::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &,long)"
(?printSolution@IloOplModelI@@QAEXAAV?$basic_ostre am@DU?$char_traits@D@std@@@std@@J@Z)
referenced in function "public: void __thiscall
IloOplModel::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &)"
(?printSolution@IloOplModel@@QAEXAAV?$basic_ostrea m@DU?$char_traits@D@std@@@std@@@Z)

Any idea why this is happening? Is this because OPL libraries are not
linked properly? If it is, how do I link the OPL library files using cl
in the command line? I am pretty new to using the cl compiler. Thanks in
advance.

This is not really a C++ *language* issue
(http://www.parashift.com/c++-faq-lit....html#faq-5.9), but a
tools and environment and/or third-party library issue. [OT]However, it
appears that IloOplModel::printSolution() does not appear in the files
supplied to the linker. I gather that this is a library class' member
function, not your own class' member function. Did you build the
library correctly? Has that function been deprecated or intentionally
omitted from the library? Have you supplied all necessary files to the
linker?[/OT]

For further help, you may want to ask in a forum dedicated to your
development tools or to the library.

Cheers! --M
I believe this is linking error is caused because the linker can't find
the symbol, the following example will also cause this linking error:

extern char B[100]; // B is not in avilable to the linker
int main() {
B[0] = ' ';
}

For more details go to the following web site:

http://msdn2.microsoft.com/en-us/library/799kze2z.aspx

Oct 27 '06 #3

P: n/a
error LNK2019: unresolved external symbol "public: void __thiscall
IloOplModelI::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &,long)"
(?printSolution@IloOplModelI@@QAEXAAV?$basic_ostre am@DU?$char_traits@D@std@@@std@@J@Z)
referenced in function "public: void __thiscall
IloOplModel::printSolution(class std::basic_ostream<char,struct
std::char_traits<char &)"
(?printSolution@IloOplModel@@QAEXAAV?$basic_ostrea m@DU?$char_traits@D@std@@@std@@@Z)

Any idea why this is happening?
Like others have said, it's a linking error because it can't find the
appropriate printSolution function. It looks like you're using
something like printSolution(string&, long) - I've seen this kind of
link error when my library was compiled with Unicode and my other code
was compiled without Unicode (or vice versa). Assuming you have a
printSolution somewhere (i.e., didn't just forget to write that
function), I'd check Unicode settings.

Michael

Oct 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.