C++ threading and Wine

Questions about Wine on Linux
Locked
guni
Newbie
Newbie
Posts: 2
Joined: Mon Dec 29, 2014 4:08 am

C++ threading and Wine

Post by guni »

I wanted to run a C++ program that I developed on Windows 7 and compiled with Visual Studio 2013, on Ubuntu 14.04, using Wine 1.6.

As expected, I was getting a lot of errors, so I tried something simple instead:

Code: Select all

#include <iostream>
    
int main() {
    std::cout << "Hello main\n";
}
I linked to the static version of the C++ runtime library (`Runtime Library` to set to `/MT`) so I wouldn't need any .dll's. And this worked just fine.

Image

But then I added some very simple threading:

Code: Select all

#include <iostream>
#include <thread>

void call_from_thread() {
    std::cout << "Hi from thread\n";
}
   
int main() {
    std::thread t(call_from_thread);
    t.join();
    return 0;
}
This compiled and ran fine on my Windows machine (of course), but running it on Ubuntu through Wine gave me some ugly errors and this box:
Image

Clicking "Show Details" shows nothing and exits Wine, but clicking "Close" spits out more output:
Image

I tried again, this time changing linking to the shared version of the C++ Runtime Library (`Runtime Library` to set to `/MD`), then grabbed `msvcr120.dll` and `msvcp120.dll` from my `C:/Windows/SysWOW64` directory on Windows machine for Wine to use. But I got pretty much the same error messages.

Searching through Google suggests that threading is supported by Wine, so I have no idea why my program fails.
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: C++ threading and Wine

Post by dimesio »

Your Wine version is old and no longer supported; try the latest development release. If it still doesn't work in current Wine in a clean wineprefix, file a bug and attach your test case to it.
guni
Newbie
Newbie
Posts: 2
Joined: Mon Dec 29, 2014 4:08 am

Re: C++ threading and Wine

Post by guni »

Thanks, that solved it :)
Locked