Adding libcmt.lib conflicts with libmingw32.a default lib
I am trying to port a MS visual studio 9 VC++ console project into Qt. For the most part it is going very well. However I have to use a 3rd party library called _apcoambe.lilb. This library seems to rely on some mathematical functions to do with 64-bit multiplication/shifts.
The functions it uses are _allmul, I believe that prototype for that is somthing like:
INT64 _allmul(INT32, INT32)
After some digging around I found that this function exists in the MsDev library libcmt.lib. So I added that to my project as well, see .pro file snippet:
LIBS += -Llib
LIBS += -l_apcoambe
LIBS += -llibcmt
However this gives me errors like:
libmingw32.a(lib32_libmingw32_a-merr.o):merr.c:(.text+0x60): multiple definition of `_matherr'
lib/libcmt.lib(f:/dd/vctools/crt_bld/SELF_X86/crt/prebuild/build/INTEL/mt_obj/matherr.obj):(.text[__matherr]+0x0): first defined here
So there seems to be some over-lap with the microsoft libraries and the QT/Mingw libraries.
I am using Qt SDK 5.0.2
The easiest way for me would be if the mingw compiler has these functions _allmul somewhere that I can include :o
But I am open to any suggestions for how to resolve this issue.
Your description has a couple of inaccuracies. You cannot port from a compiler environment to Qt libs. Qt libs are available for different compilers. Please check the "download page":http://qt-project.org/downloads for details. You must have have chosen a compiler environment while downloading Qt SDK.
Presumably this has been MinGW. So you would be porting from a ms compiler to MinGW. Unfortunately you need to have a consistent compiler environment for Qt libs and your own source. In general you cannot mix msvc compiler libs and MinGW libs. The same is for the different versions of compilers. You cannot mix msvc 2007 and msvc 2010 libs for instance. Also MinGW V4.7 and MinGW V4.4 libs are not compatible. That is most likely the source of your error.
Firstly, thanks for the correction and info.
Yes I am using mingw that comes with Qt SDK 5.0.2.
The library I am trying to use _apcoambe requires the function _allmul which exists in the msvc libraries. But it does not exist in the mingw libraries. THAT is the source of my problems :o
So I am trying to figure out how I can get these functions into my project. I guess I can find the source code assembler and include that in my code to get at these functions, but its a bit of a pain to do that :(
If the original project is done using visual studio, why not also use the visual studio version of Qt ?
Ah...well, good suggestion, I probably should mention that I am porting this project to Qt specifically because if I can get it working on Windows (as a non-Microsoft project) then I can the Qt project onto Linux.
I have done Qt-Win to Qt-Lin before and works really well with minimal fuss. So we want to port this MSVC onto linux and my thinking is to use Qt (i.e. port it into Qt first to get it working and then port the Qt proj onto linux).
Well, you need to check the background of _apcoambe. Where does it come from and which compiler is used? If you can get the source, you may be able to recompile with MinGW. _apcoambe might be completely ms dependent, than you have luck with getting your source running under windows and linux.
Yes, this is pretty much where I am at. Getting the actual source and re-compiling it with mingw, but its at least re-assuring to hear others come to that conclusion and I am not just being stupid and missing an obvious trick!
I had seen during a google search which pointed to a specific ms function, but I cannot find it anymore. Apparently, it might be a simple 64 bit integer multiplication.
"This might be of help":http://source.winehq.org/WineAPI/_allmul.html
Good luck in your adventure ;-)
Yes, this is pretty much all this functions is!.... probably I should just implement it myself and make a little cpp/h file pair to use them, it would seem to be the easiest of all methods :o
Thanks all, it has been very useful for me to talk this through :)
If I get it working that way I will put on some feedback.