''LoadLibraryW' : cannot convert parameter 1 from 'char *' to 'LPCWSTR'

Hello,

I’m a beginner and try to use the FrontPanel dll with my Qt program in VS2008.
I added “okFrontPanelDLL.h” and "okFrontPanelDLL.cpp on my project, include the .h on my other class and put the okFrontPanel.dll on the main folder.
But when i first try to compile i get the error : '‘LoadLibraryW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’
Corresponding to the line :
#if defined(WIN32)
return((DLL *) LoadLibrary(libname));

I already tryed to change the “Use Unicode Character Set” to “Use Multi-byte Character Set” but nothing change. Anyway i would like to use unicode character in my future application so i would like to resolve the problem instead of bypass it.:slight_smile:

I also tryed to put (LPCWSTR) before the libname. Actually it seems to correct the error cause the code compile, but the dll isn’t load, so i feel that this trick didn’t really fix the problem.:frowning:

Hope for your help:D
Thank you

Hello,

i have exactly the same problem with vs2012. Is there any possibilty to fix this problem?

Best regards

What problem are you having? Are you able to build the samples? What are your VS settings?

I have a problem using FrontPanel in a qt project with vs2012. When i try to compile the code, i get the error: “’‘LoadLibraryW’ : cannot convert parameter 1 from ‘char *’ to ‘LPCWSTR’” in line 735 of the “okFrontPanelDLL.cpp” file.

I tried to cast the variable

#if defined(_WIN32) return((DLL *) LoadLibrary((LPCWSTR)libname));

So the code compiles, but isn’t working. I also tried to change the character set but…

When I use a visual c++ project for my FrontPanel code, it works fine. The problem only appears while using FrontPanel in a QT-Project.

I’m working with QT 5.1 and the msv Add-In.

Unfortunately, I don’t think this is the best forum to be asking the question. This forum is primarily focused on FrontPanel and Opal Kelly products. Although the question is related to the FrontPanel DLL, it is really about the Microsoft API LoadLibraryW. You might have more luck searching Microsoft or Qt forums.

I did a Google search for “Qt and LoadLibraryW” and found a few links that may be helpful:

http://qt-project.org/forums/viewthread/19203

Solution:

return((DLL *) LoadLibrary(L"okFrontPanel.dll"));