I am attempting to implement some TWAIN functionality into a QT project. I have opened this code from the provider and compiled it. However when I past the code into my project it wont compile.
Basically I have 3 files CommonTWAIN.h, TwainAPP.cpp, and DSMInterface.cpp.
In CommonTwain.h I define a constant I believe, called. kTWAIN_DSM_DLL_NAME
/* CommonTWAIN.h */
#ifdef TWH_CMP_MSC
#ifdef TWH_64BIT
#define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll"
#else
#define kTWAIN_DSM_DLL_NAME "TWAINDSM.dll"
#endif // #ifdef TWH_64BIT
#elif defined(TWH_CMP_GNU)
#define kTWAIN_DSM_DLL_NAME "libtwaindsm.so"
#else
#error Sorry, we don't recognize this system...
#endif
In TwainApp.cpp I use that constant in a function call.
/* TwainApp.cpp */
LoadDSMLib(kTWAIN_DSM_DIR kTWAIN_DSM_DLL_NAME)
That function calls code that is in DSMInterface.cpp defined by
/* DSMInterface.h */
bool LoadDSMLib(char* _pszLibName);
I get stuck with this error
However The code also provides a visual studio solution that I can open and compile. This works as expected with the same code. So I am assuming I just have something configured wrong. This is fairly out of what I am comfortable with but I do think I am missing something simple.
So far I have tried adding QMAKE_CXXFLAGS = -permissive
to the project file. no luck.
CodePudding user response:
you should be able to cast it away:
LoadDSMLib((char*)(kTWAIN_DSM_DIR kTWAIN_DSM_DLL_NAME))
as long as the function isn't trying to modify the string it should be fine.