Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have gave up on creating a GUI directly from the windows API so I'm going to use forms. I would like to multithread my app and wrap the GUI in a class and put it in a separate thread. When I click a button, etc, it would change a value in a struct that will be read from the main thread. My problem is, when I compile my application I get an error with the linker.

1>Core.obj : error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x0100001f).

My code for main is as follows.

int main()
{
//create thread object pointer
    boost::thread *GUIThread;
//create pointer to GUIInterface, which contains a member function that
//contains the Application::Run
    GUIInterface *myinterface;
    myinterface = new GUIInterface;

    GUIThread = new boost::thread(boost::bind(&GUIInterface::MainFunction, myinterface));
    return 0;
}

It works fine when creating the class and calling the function in the main thread, but using boost causes problems. I built boost using the correct compiler MSVC-10.0 and the threading library has always worked in the past, but clr just causes problems. Any recommendations on how to fix this? OR if I should just use .net multithreading(if I do, I really need some links to how to use in with c++, most stuff I find is in C#). Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
491 views
Welcome To Ask or Share your Answers For Others

1 Answer

There are two problems when using boost::thread in a managed application. The first is the linker error you encountered. The second is an initialization error at application startup if the boost::thread implementation is statically linked with your application.

Both problems are mentioned in an older bug report. I don't know if this has changed in later releases; 1.43 has the same problem. I assume not as the case was closed wontfix.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...