Can't compile cURL with MinGW

  • (2 Pages)
  • +
  • 1
  • 2

25 Replies - 3622 Views - Last Post: 06 June 2016 - 05:43 AM Rate Topic: -----

#1 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Can't compile cURL with MinGW

Posted 13 May 2016 - 12:59 AM

Hi

I'm trying to compile cURL with MinGW (G++-), but it ain't working.

This is the G++ command I'm using:
g++ c:/users/5tif/desktop/example04.cpp -o c:/users/5tif/desktop/example04 -lcurl


At first I got the error:

Quote

c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lcurl
collect2.exe: error: ld returned 1 exit status


Then I copied the two files from this folder:
C:\Users\5TIF\Downloads\curl-7.48.0-win64-mingw\curl-7.48.0-win64-mingw\lib
(libcurl.a and libcurldll.a) to my MinGW/lib folder.

When I tried the same G++ command again I got this second 'error':

Quote

C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x81): undefined reference to `_imp___ZN6curlpp7CleanupC1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x8d): undefined reference to `_imp___ZN6curlpp4EasyC1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0xb6): undefined reference to `_imp___ZN6curlpp4Easy6setOptERKNS_10OptionBaseE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x10c): undefined reference to `_imp___ZN6curlpp4Easy6setOptERKNS_10OptionBaseE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x139): undefined reference to `_imp___ZN6curlpp4Easy7performEv'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x265): undefined reference to `_imp___ZlsRSoRKSt4listISsSaISsEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x296): undefined reference to `_imp___ZN6curlpp4EasyD1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x2a2): undefined reference to `_imp___ZN6curlpp7CleanupD1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x32c): undefined reference to `_imp___ZN6curlpp4EasyD1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text+0x33e): undefined reference to `_imp___ZN6curlpp7CleanupD1Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp11OptionTraitIbL10CURLoption41EEC1ERKb[__ZN6curlpp11OptionTraitIbL10CURLoption41EEC1ERKb]+0x29): undefined reference to `_imp___ZTVN6curlpp11OptionTraitIbL10CURLoption41EEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp11OptionTraitISsL10CURLoption10002EEC1ERKSs[__ZN6curlpp11OptionTraitISsL10CURLoption10002EEC1ERKSs]+0x29): undefined reference to `_imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp4InfoIL8CURLINFO1048577ESsE3getERKNS_4EasyERSs[__ZN6curlpp4InfoIL8CURLINFO1048577ESsE3getERKNS_4EasyERSs]+0x1c): undefined reference to `curlpp::InfoTypeConverter<std::string>::get(curlpp::Easy const&, CURLINFO, std::string&)'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp4InfoIL8CURLINFO1048577ESsE3getERKNS_4EasyE[__ZN6curlpp4InfoIL8CURLINFO1048577ESsE3getERKNS_4EasyE]+0x25): undefined reference to `curlpp::InfoTypeConverter<std::string>::get(curlpp::Easy const&, CURLINFO, std::string&)'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp4InfoIL8CURLINFO2097154ElE3getERKNS_4EasyE[__ZN6curlpp4InfoIL8CURLINFO2097154ElE3getERKNS_4EasyE]+0x1c): undefined reference to `curlpp::InfoTypeConverter<long>::get(curlpp::Easy const&, CURLINFO, long&)'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp4InfoIL8CURLINFO4194331ESt4listISsSaISsEEE3getERKNS_4EasyE[__ZN6curlpp4InfoIL8CURLINFO4194331ESt4listISsSaISsEEE3getERKNS_4EasyE]+0x25): undefined reference to `curlpp::InfoTypeConverter<std::list<std::string, std::allocator<std::string> > >::get(curlpp::Easy const&, CURLINFO, std::list<std::string, std::allocator<std::string> >&)'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbEC2E10CURLoptionRKb[__ZN6curlpp6OptionIbEC2E10CURLoptionRKb]+0x16): undefined reference to `_imp___ZN6curlpp10OptionBaseC2E10CURLoption'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbEC2E10CURLoptionRKb[__ZN6curlpp6OptionIbEC2E10CURLoptionRKb]+0x24): undefined reference to `_imp___ZTVN6curlpp6OptionIbEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbEC2E10CURLoptionRKb[__ZN6curlpp6OptionIbEC2E10CURLoptionRKb]+0x54): undefined reference to `_imp___ZN6curlpp10OptionBaseD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbED2Ev[__ZN6curlpp6OptionIbED2Ev]+0xe): undefined reference to `_imp___ZTVN6curlpp6OptionIbEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbED2Ev[__ZN6curlpp6OptionIbED2Ev]+0x35): undefined reference to `_imp___ZN6curlpp10OptionBaseD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsEC2E10CURLoptionRKSs[__ZN6curlpp6OptionISsEC2E10CURLoptionRKSs]+0x16): undefined reference to `_imp___ZN6curlpp10OptionBaseC2E10CURLoption'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsEC2E10CURLoptionRKSs[__ZN6curlpp6OptionISsEC2E10CURLoptionRKSs]+0x24): undefined reference to `_imp___ZTVN6curlpp6OptionISsEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsEC2E10CURLoptionRKSs[__ZN6curlpp6OptionISsEC2E10CURLoptionRKSs]+0x54): undefined reference to `_imp___ZN6curlpp10OptionBaseD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsED2Ev[__ZN6curlpp6OptionISsED2Ev]+0xf): undefined reference to `_imp___ZTVN6curlpp6OptionISsEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsED2Ev[__ZN6curlpp6OptionISsED2Ev]+0x41): undefined reference to `_imp___ZN6curlpp10OptionBaseD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsED2Ev[__ZN6curlpp6OptionISsED2Ev]+0x65): undefined reference to `_imp___ZN6curlpp10OptionBaseD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.rdata$_ZTVN6curlpp11OptionTraitIbL10CURLoption41EEE[__ZTVN6curlpp11OptionTraitIbL10CURLoption41EEE]+0x10): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp11OptionTraitIbL10CURLoption41EED1Ev[__ZN6curlpp11OptionTraitIbL10CURLoption41EED1Ev]+0xe): undefined reference to `_imp___ZTVN6curlpp11OptionTraitIbL10CURLoption41EEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.rdata$_ZTVN6curlpp6OptionIbEE[__ZTVN6curlpp6OptionIbEE]+0x10): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.rdata$_ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE[__ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE]+0x10): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp11OptionTraitISsL10CURLoption10002EED1Ev[__ZN6curlpp11OptionTraitISsL10CURLoption10002EED1Ev]+0xe): undefined reference to `_imp___ZTVN6curlpp11OptionTraitISsL10CURLoption10002EEE'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.rdata$_ZTVN6curlpp6OptionISsEE[__ZTVN6curlpp6OptionISsEE]+0x10): undefined reference to `curlpp::OptionBase::operator<(curlpp::OptionBase const&) const'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp11UnsetOptionD1Ev[__ZN6curlpp11UnsetOptionD1Ev]+0x18): undefined reference to `_imp___ZN6curlpp12RuntimeErrorD2Ev'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionIbE16updateMeToOptionERKNS_10OptionBaseE[__ZN6curlpp6OptionIbE16updateMeToOptionERKNS_10OptionBaseE]+0x5c): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1EPKc'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZNK6curlpp11OptionTraitIbL10CURLoption41EE16updateHandleToMeEPNS_8internal10CurlHandleE[__ZNK6curlpp11OptionTraitIbL10CURLoption41EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x51): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1ERKSs'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE[__ZN6curlpp6OptionISsE16updateMeToOptionERKNS_10OptionBaseE]+0x5c): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1EPKc'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZNK6curlpp11OptionTraitISsL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE[__ZNK6curlpp11OptionTraitISsL10CURLoption10002EE16updateHandleToMeEPNS_8internal10CurlHandleE]+0x51): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1ERKSs'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZNK6curlpp6OptionIbE8getValueEv[__ZNK6curlpp6OptionIbE8getValueEv]+0x51): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1ERKSs'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZNK6curlpp6OptionISsE8getValueEv[__ZNK6curlpp6OptionISsE8getValueEv]+0x51): undefined reference to `_imp___ZN6curlpp11UnsetOptionC1ERKSs'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp8internal10CurlHandle6optionIbEEv10CURLoptionT_[__ZN6curlpp8internal10CurlHandle6optionIbEEv10CURLoptionT_]+0x28): undefined reference to `_imp__curl_easy_setopt'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp8internal10CurlHandle6optionIbEEv10CURLoptionT_[__ZN6curlpp8internal10CurlHandle6optionIbEEv10CURLoptionT_]+0x42): undefined reference to `_imp___ZN6curlpp20libcurlRuntimeAssertEPKc8CURLcode'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_[__ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_]+0x21): undefined reference to `_imp__curl_easy_setopt'
C:\Users\5TIF\AppData\Local\Temp\ccss6bfK.o:example04.cpp:(.text$_ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_[__ZN6curlpp8internal10CurlHandle6optionIPvEEv10CURLoptionT_]+0x3b): undefined reference to `_imp___ZN6curlpp20libcurlRuntimeAssertEPKc8CURLcode'
collect2.exe: error: ld returned 1 exit status


This is the example code I'm trying to compile:
/*
 *    Copyright (c) <2002-2005> <Jean-Philippe Barrette-LaPierre>
 *    
 *    Permission is hereby granted, free of charge, to any person obtaining
 *    a copy of this software and associated documentation files 
 *    (curlpp), to deal in the Software without restriction, 
 *    including without limitation the rights to use, copy, modify, merge,
 *    publish, distribute, sublicense, and/or sell copies of the Software,
 *    and to permit persons to whom the Software is furnished to do so, 
 *    subject to the following conditions:
 *    
 *    The above copyright notice and this permission notice shall be included
 *    in all copies or substantial portions of the Software.
 *    
 *    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 *    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 *    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
 *    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
 *    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 *    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

/**
* \file
* Getting options using curlpp::infos.
* 
*/


#include <cstdlib>

#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
#include <curlpp/Exception.hpp>
#include <curlpp/Infos.hpp>
 

int main(int argc, char *argv[])
{
	if(argc != 2)
	{
		std::cerr << "Example 04: Wrong number of arguments" << std::endl 
			<< "Example 04: Usage: example04 url" 
			<< std::endl;
		return EXIT_FAILURE;
	}
	char *url = argv[1];

	try 
	{
		curlpp::Cleanup cleaner;
		curlpp::Easy request;

		using namespace curlpp::Options;
		request.setOpt(Verbose(true));
		request.setOpt(Url(url));

		request.perform();

		std::string effURL;
		curlpp::infos::EffectiveUrl::get(request, effURL);
		std::cout << "Effective URL: " << effURL << std::endl;

		//other way to retreive URL
		std::cout << std::endl 
			<< "Effective URL: " 
			<< curlpp::infos::EffectiveUrl::get(request)
			<< std::endl;

		std::cout << "Response code: " 
			<< curlpp::infos::ResponseCode::get(request) 
			<< std::endl;

		std::cout << "SSL engines: " 
			<< curlpp::infos::SslEngines::get(request)
			<< std::endl;
	}
	catch ( curlpp::LogicError & e ) {
		std::cout << e.what() << std::endl;
	}
	catch ( curlpp::RuntimeError & e ) {
		std::cout << e.what() << std::endl;
	}

	return 0;
}





This is the tree of my MinGW folder (libs and include):
http://pastebin.com/PvdUP32H

I'm using Windows 10 64-bit, what am I doing wrong?
Compiling simple libraries like SFML is lucking for me, but I never seem to be able to compile big libraries like libcurl.
Yet, it's very important to know how to do it.

What am I doing wrong?
Thanks!
What am I doing wrong and how to fix it?

This post has been edited by O'Niel: 13 May 2016 - 01:01 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Can't compile cURL with MinGW

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6216
  • View blog
  • Posts: 21,452
  • Joined: 05-May 12

Re: Can't compile cURL with MinGW

Posted 13 May 2016 - 06:40 AM

Are you trying to compile CURL? From what you've shown, you are trying to link in CURL. There is a difference.
Was This Post Helpful? 0
  • +
  • -

#3 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 14 May 2016 - 08:07 AM

Yeah, I'm trying to link cURL and compile an example program using cURL. Sorry.
Was This Post Helpful? 0
  • +
  • -

#4 #define   User is offline

  • Duke of Err
  • member icon

Reputation: 1853
  • View blog
  • Posts: 6,671
  • Joined: 19-February 09

Re: Can't compile cURL with MinGW

Posted 14 May 2016 - 02:35 PM

Hi, you seem to have mingw32 (32 bit) and curl 64 (64 bit). Are you compiling at 32 bit?
Was This Post Helpful? 0
  • +
  • -

#5 kaa   User is offline

  • D.I.C Addict

Reputation: 225
  • View blog
  • Posts: 805
  • Joined: 15-April 11

Re: Can't compile cURL with MinGW

Posted 14 May 2016 - 03:56 PM

Apparently -lcurl won't do it. This link may not correspond exactly to your directory tree but it should give you the gist of it.
Was This Post Helpful? 1
  • +
  • -

#6 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 15 May 2016 - 02:03 AM

@kaa: Still getting same error:
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lcrypto
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -leay32
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lidn
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lrtmp
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lssh2
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lz
c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lssl32
collect2.exe: fout: ld gaf exit-status 1 terug



Now only for all packages I'm trying to link.
Was This Post Helpful? 0
  • +
  • -

#7 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1467
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Can't compile cURL with MinGW

Posted 15 May 2016 - 09:59 PM

Hmmm,

weird you are trying to compile a curlpp program to do that you need to download and build curlpp, have you done that ?

curlpp is a c++ wrapper for libcurl.

So you need both curl and curlpp libraries for this to work.

command line

g++ c:/users/5tif/desktop/example04.cpp -o c:/users/5tif/desktop/example04 -lm -lcurl -lcurlpp




Regards

Snoopy.
Was This Post Helpful? 1
  • +
  • -

#8 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 16 May 2016 - 04:46 AM

View Postsnoopy11, on 15 May 2016 - 09:59 PM, said:

Hmmm,

weird you are trying to compile a curlpp program to do that you need to download and build curlpp, have you done that ?

curlpp is a c++ wrapper for libcurl.

So you need both curl and curlpp libraries for this to work.

command line

g++ c:/users/5tif/desktop/example04.cpp -o c:/users/5tif/desktop/example04 -lm -lcurl -lcurlpp




Regards

Snoopy.


I have downloaded curlpp and copied the files of the include-folder, and the lib-folder into the matching folders of MinGW. But I haven't built curlpp. How would I do that? I see files in curlpp-master like INSTALL, Makefile, and Configure; but those are for Linux; right now I'm using Windows...

Your command says -lm is found, but the other two not.
Was This Post Helpful? 0
  • +
  • -

#9 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1467
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Can't compile cURL with MinGW

Posted 16 May 2016 - 09:05 PM

If you are going to build libraries I suggest you get the appropriate tools.


MSys - a unix like environment for windows for building libraries

CMake - a cross platform library building tool.


looking at curlpp CMake would seem the better option.

Regards

Snoopy.
Was This Post Helpful? 0
  • +
  • -

#10 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 17 May 2016 - 05:45 AM

I still have a few questions because this is the first time I actually 'build' a library.
1) Why do I have to build, and what exactly is building? It's just compiling, right?
2) Why do I have to build a library like cURLPP, but not SFML for example?
3) I get errors when using cMAKE:
http://i66.tinypic.com/2zsmz35.png

Error:

Quote

CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
Configuring incomplete, errors occurred!

Was This Post Helpful? 0
  • +
  • -

#11 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 18 May 2016 - 02:38 AM

When I changed my compiling tool to Visual Studio 2015, I got this:

Quote

CMake Error at utilspp/CMakeLists.txt:4 (add_subdirectory):
add_subdirectory given source "singleton" which is not an existing
directory.


You have called ADD_LIBRARY for library internal without any source files. This typically indicates a problem with your CMakeLists.txt file
You have called ADD_LIBRARY for library curlpp without any source files. This typically indicates a problem with your CMakeLists.txt file
CMake Error at curlpp/CMakeLists.txt:16 (install):
install Library TARGETS given no DESTINATION!


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.5)

should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!
See also "C:/Users/5TIF/Desktop/curlpp_foo/CMakeFiles/CMakeOutput.log".


Singleton is an existing library (In the original package, and I manually made it in the targetted directory after this error). And by the way, add_subdirectory(); ain't it supposed to add non-existing directories?

I have given my source and destination paths, yet I'm getting that strange error. What am I doing wrong?

If I use Visual Studio 2014 for this, will I be able to compile my own project with MinGW G++?
Was This Post Helpful? 0
  • +
  • -

#12 kaa   User is offline

  • D.I.C Addict

Reputation: 225
  • View blog
  • Posts: 805
  • Joined: 15-April 11

Re: Can't compile cURL with MinGW

Posted 18 May 2016 - 05:11 AM

View PostO, on 18 May 2016 - 05:38 AM, said:

If I use Visual Studio 2014 for this, will I be able to compile my own project with MinGW G++?

I don't know the answer to that, but you shouldn't have to go through all of that anyway.

It's not clear which exact version of curl you downloaded, but this is the one you want:curl-7.40.0-devel-mingw64 (This is Gunter Knauf's "devel" build.)

Download that, extract it (7-zip), and place the entire directory in a convenient place (and rename it simply 'curl' for convenience). I used C:\Program Files\curl.

In CodeBlocks:
go to Project/build options/compiler settings/#defines and enter
CURL_STATICLIB

go to Project/build options/Linker settings and under Link libraries add these entries, IN THE FOLLOWING ORDER:
curl
rtmp
ssl
ssh2
crypto
z
wldap32
ws2_32
winmm
gdi32

On the same Project/build options/Linker settings page, under Other linker options, add this:
-static

go to Project/build options/Search directories/Compiler and add the full path to your curl\include directory. I used:
C:\Program Files\curl\include

go to Project/build options/Search directories/Linker and add the full path to your curl\lib64 directory. I used:
C:\Program Files\curl\lib64

After following these steps you should be able to build and run the simple.c example program that's included in the curl download.

This post has been edited by kaa: 18 May 2016 - 05:13 AM

Was This Post Helpful? 1
  • +
  • -

#13 snoopy11   User is offline

  • Engineering ● Software
  • member icon

Reputation: 1467
  • View blog
  • Posts: 4,726
  • Joined: 20-March 10

Re: Can't compile cURL with MinGW

Posted 18 May 2016 - 09:27 PM

The OP is trying to run a curlpp program,

curlpp does depend on curl.

so while that takes care of curl installation,

The OP would still have to build curlpp.

unless you can find a prebuilt MinGW version of curlpp that is.

Regards.
Was This Post Helpful? 1
  • +
  • -

#14 kaa   User is offline

  • D.I.C Addict

Reputation: 225
  • View blog
  • Posts: 805
  • Joined: 15-April 11

Re: Can't compile cURL with MinGW

Posted 19 May 2016 - 05:59 AM

Sorry, I somehow managed to overlook that.
Was This Post Helpful? 0
  • +
  • -

#15 O'Niel   User is offline

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 408
  • Joined: 13-September 15

Re: Can't compile cURL with MinGW

Posted 26 May 2016 - 01:50 AM

@Kaa:
I did exactly what you said, and this is the error I got in Code::Blocks:

Quote

-------------- Build: Debug in a (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -DCURL_STATICLIB -g -I..\curl\include -c C:\Users\5TIF\Desktop\a\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -L..\curl\lib64 -o bin\Debug\a.exe obj\Debug\main.o -static -lcurl -lrtmp -lssl -lssh2 -lcrypto -lz -lwldap32 -lws2_32 -lwinmm -lgdi32
obj\Debug\main.o: In function `main':
C:/Users/5TIF/Desktop/a/main.cpp:30: undefined reference to `curl_easy_init'
C:/Users/5TIF/Desktop/a/main.cpp:32: undefined reference to `curl_easy_setopt'
C:/Users/5TIF/Desktop/a/main.cpp:34: undefined reference to `curl_easy_setopt'
C:/Users/5TIF/Desktop/a/main.cpp:37: undefined reference to `curl_easy_perform'
C:/Users/5TIF/Desktop/a/main.cpp:41: undefined reference to `curl_easy_strerror'
C:/Users/5TIF/Desktop/a/main.cpp:44: undefined reference to `curl_easy_cleanup'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
7 error(s), 0 warning(s) (0 minute(s), 0 second(s))


It's just the "simple.c" file included with that Curl-folder.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2