Hi,
I am linking my project to the curlpp and curl libraries as such:
libcurl.a
libws2_32.a
libwldap32.a
librtm.a
libgdi32.a
libz.a
libcurlpp.a
libstdc++.a
libcrypto.a
libssl.a
Here is my .h:
#include <iostream>
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
class wrapcurl
{
public:
wrapcurl() {};
virtual ~wrapcurl() {};
static std::string download(const char* url);
};
and my .cpp:
#include "wrapcurl.h"
std::string wrapcurl::download(const char* url)
{
std::stringstream response;
if (url)
try{
curlpp::Cleanup myCleanup;
curlpp::Easy foo;
foo.setOpt( new curlpp::options::Url( url ) );
foo.setOpt( new curlpp::options::WriteStream( &response ) );
foo.perform();
}//try
catch(curlpp::RuntimeError & e){
response << e.what() << std::endl;
}
catch(curlpp::LogicError & e){
response << e.what() << std::endl;
}
return response.str();
}
the compiler complains at 'curlpp::Cleanup myCleanup;' with this:
C:\Workspace_code\general\wrapcurl.cpp|11|undefined reference to `_imp___ZN6curlpp7CleanupC1Ev'|
I first though it was that it cannot find libcurlpp.a or libcurl.a but if I put the buggy line like this:
curlpp::Cleanup myCleanup();
it will compile up to the next line (the one that says 'curlpp::Easy foo;') as saying undefined reference for that line. Which means, the curlpp library is recognized. Obviously I don't want to say curlpp::Cleanup myCleanup() nor I want curlpp::Easy foo() because that is not the same behavior. Also the code completion recognizes curlpp when I type the double column (curlpp::) it will show a list of methods, including Cleanup and Easy, so again it means the libcurlpp library is recognized. Any guess what the issue would be?
My envinronment is:
OS/Platform: Win 7, 64bit
IDE: Code blocks night built svn 9677 (2/23/14)
compiler: mingw32-gcc.exe, mingw32-g++.exe
Make program: mingw32-make.exe
I have built other program on the current platform/environment, including projects with wxWidgets 3.0.1 and opengl. Linking my program with curl only and using curl functions/methods will compile and work, but not with curlpp, and I want to use curlpp. I am thinking I am missing a library, or I need to recompile curl or curlpp with more options? (if so, which options?) Thanks!