[Qt-interest] silly library question

d3fault d3faultdotxbe at gmail.com
Thu May 5 15:25:16 CEST 2011


I'm trying to use libcurl in my Qt application... but I'm failing miserably.

I added the following to my .pro file:

INCLUDEPATH += "C:\\curl-7.21.6-devel-mingw32\\include"
LIBS += -L"C:\\curl-7.21.6-devel-mingw32\\lib" -lcurl

And in my basic header file, I have the following

-----------HEADER-----------
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <curl/curl.h>
namespace Ui {
    class MainWindow;
}
class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
private:
    Ui::MainWindow *ui;
    CURL *m_Curl;
};
#endif // MAINWINDOW_H

and in the source file:
-----------SOURCE-----------
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new
Ui::MainWindow)
{
    ui->setupUi(this);
    m_Curl = curl_easy_init();
}
MainWindow::~MainWindow()
{
    delete ui;
    curl_easy_cleanup(m_Curl);
}



...but when I try to compile, I get: "undefined reference to
`_imp_curl_easy_init'"

I'm using Windows 7 x64 and Qt Creator 2.0.1 / Qt 4.7.0
The libcurl I downloaded is found on this page:
http://curl.haxx.se/download.html
Scroll all the way down and it's "Win32 - Generic" -- the bottom one that
says libcurl / SSL. Here's the direct link for simplicity's sake:
http://www.gknw.net/mirror/curl/win32/curl-7.21.6-devel-mingw32.zip

What am I doing wrong?

I realize this doesn't directly relate to Qt... but at the same time I feel
like it does because I've used shared/static libraries in visual studio
before and never had this problem. It's most definitely a user error though.

Here's a page that mentions the error I'm getting...
http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur
Am I using the wrong library? Doesn't Qt Creator use mingw32?

inb4 "use QNetworkAccessManager" ... I don't like how it handles cookies

Thanks all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110505/f9d26b19/attachment.html 


More information about the Qt-interest-old mailing list