Aaron Berry
Aaron Berry

Reputation: 481

Linker Error: LNK2022

I am trying to use boost threads in a project having common language runtime support. I get the following linker error. error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x01000073).

If i comment the line instantiating the boost thread, i do not get any linker error.

I tried looking online for fixing this error, at one such place it was suggested to use " #define BOOST_THREAD_USE_DLL" before including any boost libraries. I tried this but it still gives me the same error.

There is a related thread, ( "LNK2022: metadata operation failed" driving me insane ) but it isnt the same problem but somewhat similar. I tried the fix suggested there but still no luck.

Does anyone know how to fix this?

Upvotes: 3

Views: 4343

Answers (3)

Tollow
Tollow

Reputation: 11

In my case, similar error occurred when using OpenCV 4.1.1. VS2019 is OK, but VS2015 is not good. Error message is like this.

LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (Impl): (0x0100002a)

I searched struct or class named "Impl" in OpenCV include files. Then I could avoid the error adding the follow codes just under #include opencv headers.

namespace cv {
    namespace cuda {
        class Stream::Impl {};
    }
}
namespace cv {
    namespace cuda {
        class Event::Impl {};
    }
}

Answers in here were very helpful for me. Thank you.

Upvotes: 1

Dmitriy
Dmitriy

Reputation: 5487

# include <boost/thread.hpp>
namespace boost {
    struct thread::dummy {};
}

This helped me

Upvotes: 7

PaulH
PaulH

Reputation: 7843

Visual Studio doesn't support r-value references. Double-check your boost configuration options to make sure you're using the correct toolset. (see the boost documentation)

Also, ensure you have the current version of boost.

-PaulH

Upvotes: 0

Related Questions