Qt - Just can't get LibCurl to install no matter what I try! Need FTP
-
@Saminvent It looks like you're not linking Curl lib or Curl lib was build using different compiler than the one you're using. Please show your pro file.
-
@starkm42 said in Qt - Just can't get LibCurl to install no matter what I try! Need FTP:
because some parts of Qt code are not even c++ language compliant. qt first translates your source code to c++ compatible i.e moc_source_code.cpp
This is not correct. Qt ships MinGW which is simply Windows port of GCC. You can also use Qt with unmodified Microsoft compiler. Moc simply generates code (for signals for example), signals/slots keywords are just empty macros.
-
@jsulm yeah, i should have worded it differently. compilers are same as you would get without Qt creator but there is a pre-step before actual code gets compiled by Qt creator itself i.e. moc ?. i will redact my statement. thanks for the insight
-
My .pro file is as follows.
I get an extra error if I don't comment out the debug dll line auto added by the add library wizard. Maybe something to do with separate debug dlls no longer being needed, anyway I don't think it's what's causing my problems.QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
/# You can make your code fail to compile if it uses deprecated APIs.
/# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0SOURCES +=
main.cpp
mainwindow.cppHEADERS +=
mainwindow.hFORMS +=
mainwindow.ui/# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += targetwin32:CONFIG(release, debug|release): LIBS += -LC:/msys64/ucrt64/lib/ -llibcurl.dll
#else:win32:CONFIG(debug, debug|release): LIBS += -LC:/msys64/ucrt64/lib/ -llibcurl.dlld
#else:unix: LIBS += -LC:/msys64/ucrt64/lib/ -llibcurl.dllINCLUDEPATH += C:/msys64/ucrt64/include
DEPENDPATH += C:/msys64/ucrt64/include -
@Saminvent You don't link against
.dll
these are runtime libraries. And usually, the lib part is dropped so it should be-lcurl
. -
@starkm42
moc
is really only involved if you are writing a QObject based class which used the Q_OBJECT macro and as @jsulm said it's a code generator. You can even dropmoc
if using the verdigris project. Qt is a C++ framework and it follows the rules and the standard. If it were not, you would not be able to compile it. -
Hiya, okay so I tried various things (including changing the .pro line to LIBS += -LC:/msys64/ucrt64/lib/ -lcurl as before I was using the win32:config which I think broke things, maybe meant to be win64?) and that helped a bit, then I was having issues with qDebug() crashing the application (and this is still an issue at the time of writing this). I then also edited all the header files to use absolute paths just in case once into curl.h other linked header files couldn't find each other with relative paths. This is obviously not a solution for deployment but a good debugging tool.
Anyway, now it just seems to build and work correctly, without qDebug().
What's strange is that in a brand new application this was working, but adding the curl library seems to have broken it.Current state of things - curl successfully pulls data off a test website and I'll now try to implement ftp with it. The issue I have now is that if I use qDebug() the application exits with an error saying it crashed.
Any thoughts on the cause of this?
-
Have tried on fresh applications and linking the library doesn't break qDebug() but as soon as I add my #include for curl.h, it does break. With normal run in debug mode it just crashes, but if I run with debugger, I get the following errors, but I am able to get qDebug() outputs displaying in the Application Output window.
Invalid address specified to RtlFreeHeap( 0000024C02A30000, 0000024C04401A80 )
MainWindow Opened
clientcore\windows\advcore\ctf\uim\tim.cpp(800)\MSCTF.dll!00007FFD8BEF62B9: (caller: 00007FFD8BEF6EEC) LogHr(1) tid(319c) 8007029C An assertion failure has occurred.
clientcore\windows\advcore\ctf\uim\tim.cpp(800)\MSCTF.dll!00007FFD8BEF62B9: (caller: 00007FFD8BEF6EEC) LogHr(2) tid(319c) 8007029C An assertion failure has occurred.
mincore\com\oleaut32\dispatch\ups.cpp(2126)\OLEAUT32.dll!00007FFD8A60470C: (caller: 00007FFD8A6049FA) ReturnHr(1) tid(319c) 8002801D Library not registered. -
@Saminvent what if you include curl before all Qt headers ?