2
votes

I have a VS2010 dll I'm trying to link into a QT project. I'm using QT version 4.7.4 that I built using MSVC2010. QT Creator is also using MSVC2010 to compile.

I'm implicitly linking by including the header files, referencing the .lib in the pro file, and placing the .dll in the execution folder.

Right now I'm only using functions from one class from the dll. Some of the functions link, some of them don't. Dependency walker confirms that they're all being exported just fine.

The functions that don't link take a std::wstring or a std::wstring* as a parameter.

Is something redefining wstring somewhere? Any ideas would be helpful.

1
I've read about people having success either rebuilding QT with the option "treat wchar_t as built in type" set to false, or changing a project setting to not use built in types. I'm saving rebuilding QT as a last option since it takes forever, but I can't find that project option anywhere.Ash
Can you be more specific about "Won't link", preferably by including the full text of the error message.Clare Macrae

1 Answers

1
votes

So for anyone else getting this problem, I just figured it out.

The linker was breaking because Visual Studio by default maps wchar_t to __wchar_t, and QT does not.

To fix: Go to Project Settings -> Configuration Properties -> C/C++ -> Language and uncheck the "Treat WChar_t As Built in Type" property.