PDA

View Full Version : qt application using cURL compiled in Visual Studio 2010



xrep
17th December 2011, 00:46
Hello everyone!,

i am developing an application in which i am using cURL for getting source code of webpages. Now I need GUI a I choose Qt...
But I have problem with linking cURL with Qt ..
I am really confused, this is first time where I am linking multiple different libraries in windows.

What I need:
- it would be great if will be application portable. No install, just copy.
- as small size of application as possible.

I downloaded source code of Qt 4.7.4 and compiled with Visual Studio 2010, but without param -static. Then installed add-in/VS 2010, and write some code for GUI, then added cURL. But problem is, that my cUrl is compilided asstatic library, and now I have some problems with linking.

I suppose that I must use cURL compiled as dynamic library, if I want use my actually compiled Qt.

What would be better for my needs? Qt compiled as dynamic with cURL as dynamic, or all as static?
Can somebody explain me, or give me some links where it is described?

Thanks.

ChrisW67
19th December 2011, 00:56
You can use a static libcurl and a dynamic Qt without a problem. Since you don't tell us what the "I have some problems with linking" are so we cannot provide any specific help. You probably have incorrect or missing LIBS entries in your pro file.

xrep
24th December 2011, 00:19
Thanks for your reply Chris..

I am very glad reading "You can use a static libcurl and a dynamic Qt without a problem."

Errors shown in Visual Studio:

error LNK1169: one or more multiply defined symbols found
error LNK2005: ___iob_func already defined in MSVCRTD.lib(MSVCR100D.dll)
many other similar errors..

warnings
warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library

... When I compiled libcurl I used /MTd Multi-Threaded debug, now when I compiling my app, and including libcurl as library I must use /MDd Multi-Threaded Debug DLL, but this not works.
And why I am using /MDd?
Because If I try compile my very simple Qt app without anything (no explicit library), just ui and one connect/slot, it cannot compiles if I set /MTd Multi-Threaded, only compiles with Runtime Library set to /MDd.

So what can be solution? Compiling libcurl with Runtime Lib set to MDd?
Or recompile Qt as static? I think this error is there because I am mixing Runtime Libraries ...

The best solution for me will be, if it can be possible to distribute app without requiring qt installed on enduser PC.

Thanks.

Added after 28 minutes:

solved... i compile cURL with Runtime Library set to Multi-threaded debug and it works..i had not idea about what i have been doing ...