Again on: How to solve .__dtor link error in MS VC++.net 2003 for codes that work in VC++ V6?

Hi,

Seems that my post on
"How to solve .__dtor link error in MS VC++.net 2003 for codes that work in VC++ V6 "
was lost.

Here is it roughly again
=================================================
I downloaded some open source c++ code from http://www.coin-or.org/
In the MS Visual C++ .NEt 2003, I set up a project (TestCLP5) with a file with 

int main (int argc, const char *argv[])

Then, On the tools\options dialog window,
I added all the folders of .h files
At the Projects -> VC++ Directories : Include files

I added all the folders of .cpp files
At the Projects -> VC++ Directories : Sources files

When I try to build the project, it reports:
TestCLP5 error LNK2020: unresolved token (0A00000A) ClpSimplex.__dtor
TestCLP5 fatal error LNK1120: 1 unresolved externals

where ClpSimplex is a class in the package.

(The author of the above code claimed that The codes work in VC++ 6.0.)
==================================================

In my alerts, I know
Jonathan Caves MSFT in Visual C++ General
and Ayman Shoukry in Visual C++ General
replied my questions.

Thank you very much!

Jonathan Caves MSFT
in Visual C++ General wrote:
Tony: the error message means that the linker cannot find a definition of the function:
ClpSimplex::~CplSimplex()
The function is being referenced in the code but no definition is provided.

My question: should I add ClpSimplex::~CplSimplex() -- I am wondering whether VC++ handles the destructor automatically.

Ayman Shoukry in Visual C++ General wrote:

The only help is that you are probably missing some lib that you need to link to. I would look at the documentation and see where the symbol is defined and then link to the appropriate lib.
Thanks,
  Ayman Shoukry
  VC++ Team

Ayman -- Thank you for the help! Waiting for your results.

Tony



Answer this question

Again on: How to solve .__dtor link error in MS VC++.net 2003 for codes that work in VC++ V6?

  • Lanceli

    hi all

    reply for this post .....

    Hadder and cpp file missing than this probelm comes in vc++2003

    plz to check first .h .cpp file present in the expoler or not ....

    right click on source file >add>ADD existing Item and pick your .cpp and .h file

    if not than attach and and Bulid your code

    i m sure run your application ..........

    thank you



  • Jayen

    Hi Tony,
    It looks like your missing some implementations related to the class ClpSimplex. Please dig into your code where it is defined and make sure you are compiling such code. Check the build log and see if the files defining such methods are compiled. You can even generate a preprocessed version of the files using the /P compiler option.

    If you have problems with the code itself, contact the folks who wrote it since they will for sure have more details on it or check its documentation if available.

    If you still have specific issues, please let us know.

    Thanks,
      Ayman Shoukry
      VC++ Team

  • stivo

    If you have 100% of the source code then you don't need a *.lib. I see you are moving from Visual C++ 6.0 to Visual C++ 2003 - did exactly the same code compile with Visual C++ 6.0



  • Sarika_MS

    I find the way to turn off /clr compiler option:

    At Projects -> Properties window
    Then Configuration properties -> General folder
    Set the "Use managed Extensions" to "no"

    However, after build, I got more errors as:

    TestCLP5 error LNK2019: unresolved external symbol "public: __thiscall ClpSimplex::~ClpSimplex(void)" ( 1ClpSimplex@@QAE@XZ) referenced in function _main
    TestCLP5 error LNK2019: unresolved external symbol "public: int __thiscall ClpSimplex::primal(int,int)" ( primal@ClpSimplex@@QAEHHH@Z) referenced in function _main
    TestCLP5 error LNK2019: unresolved external symbol "public: int __thiscall ClpSimplex::readMps(char const *,bool,bool)" ( readMps@ClpSimplex@@QAEHPBD_N1@Z) referenced in function _main
    TestCLP5 error LNK2019: unresolved external symbol "public: __thiscall ClpSimplex::ClpSimplex(void)" ( 0ClpSimplex@@QAE@XZ) referenced in function _main
    TestCLP5 fatal error LNK1120: 4 unresolved externals


  • David Clausen

    Hi, Ayman

    I misunderstood your suggestions. -- Sorry.

    In the package, I have the source code for ClpSimplex() and all the source codes, I suspect. If I had all the source code for this package, do I need .lib files

    Thanks.
    Tony

  • keiichi

    Hi, Ayman

    Thanks!

    I will try it as your instructed.

    Take care
    Tony

  • golf4dee

    Hi, Jonathan,

    How do I remove the /clr compiler option in MS VC++ .NET 2003 (Sorry for this question if it is too simple.)


    --- I do NOT want to compile the code for .NET platform.
    It is just a single thread application and should stand alone within one computer.

    Thanks a million !!!!
    Tony

  • Ian Ferguson

    Tony: I don't know why this thread was deleted.

    What is usually case going on in cases like this is that the code declares the destructor but doesn't define it. For example:

    class A {
    public:
       ~A();
    };

    If the destructor is invoked then it needs to be defined.


  • gunning

    I notice that from the error message that you appear to be compiling this code for the .NET platform (using the /clr compiler option) if this intentional

    If not: then you might want to try to remove this switch.



  • Tom Sapp

    I downloaded the codes from an open source code site.
    (http://www.coin-or.org/ 
    COmputational INfrastructure for Operations Research)
    It is a linear programming solver.

    They claim the same codes are fine in VC++ 6.
    (They even created a VC++ 6 project for this sample problem after I post the question there: please refer:
    http://list.coin-or.org/pipermail/coin-discuss/2005-November/001692.html)

    I only have VC++ .NET 2003 though.  

    To reply your early post, I checked the source code. They do have a destructor:

    ==========================
    ClpSimplex::~ClpSimplex ()

    {

    gutsOfDelete(0);

    delete nonLinearCost_;

    }
    ===========================

    Thanks a lot
    Tony


  • Again on: How to solve .__dtor link error in MS VC++.net 2003 for codes that work in VC++ V6?