cURL / Mailing Lists / curl-library / Single Mail

curl-library

Compiling libcurl 7.16.2 with VC8 (was Re: [curlib.lib] unresolved externals Problems!!)

From: Yang Tse <yangsita_at_gmail.com>
Date: Wed, 11 Apr 2007 21:35:20 +0200

(Message also as attachment)

I swear that my grandma has clean-compiled it using these steps. :-)

Ok, just be careful with typing. There are a pair of gotchas.

And yes, the curllib.vcproj is configured to build a static library,
so it is missing the definition of symbol CURL_STATICLIB

Just follow each step as written here.

01) Download http://curl.haxx.se/download/curl-7.16.2.zip
02) Unzip it to a local folder C:\MyFirstAttempt So you will also have
C:\MyFirstAttempt\curl-7.16.2\*
03) Start VS2005 (VC8)
04) From within VC8 main menu -> File -> Open -> Project/Solution ->
curllib.vcproj
05) From within VC8 Solution Explorer -> Right click on "Solution
curlib" -> Add -> New Project ->
    Project Type : Visual C++ / Win32 / Win32 Console Application
    Project Name : MyApp
    Press Ok
06) Automagically Win32 Application Wizard starts
    Press Next
    Select Console application
    Uncheck Precompiled header
    Make sure nothing else is checked
    Press Finish
07) Automagically Win32 Application Wizard closes
08) Editor opens MyApp.cpp
    Before _tmain paste:
      #include <curl.h>
    Inside _tmain paste:
      CURL *curl;
      curl_global_init(CURL_GLOBAL_ALL);
      curl = curl_easy_init();
      curl_easy_setopt(curl, CURLOPT_URL, "www.example.com");
      curl_easy_setopt(curl, CURLOPT_HEADER, TRUE);
      curl_easy_cleanup(curl);
      curl_global_cleanup();
      return 0;
09) From within VC8 main menu -> File -> Save All
10) From within VC8 Solution Explorer -> Right click on "Solution
curlib" -> Project Dependencies ->
    Window opens ->
    Check checkbox that indicates that Project MyApp depends on Project curlib
    Press Ok
11) From within VC8 Solution Explorer -> Right click on "MyApp" -> Set
as Startup Project
12) From within VC8 Solution Explorer -> Right click on "curlib" -> Properties
    Automagically MyApp Properties Pages window opens
    Select: Configuration "Debug"
    Select: Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions
    remove: _USRDLL
    add: CURL_STATICLIB
    Press Button "Apply"
    Select: Configuration "Release"
    Select: Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions
    remove: _USRDLL
    add: CURL_STATICLIB
    Press Button "Apply"
    Press Button "Accept"
13) From within VC8 Solution Explorer -> Right click on "MyApp" -> Properties
    Automagically MyApp Properties Pages window opens
    Select: Configuration "Debug"
    Select: Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions
    add: CURL_STATICLIB
    Press Button "Apply"
    Select: Configuration "Release"
    Select: Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions
    add: CURL_STATICLIB
    Press Button "Apply"
    Press Button "Accept"
14) From within VC8 Solution Explorer -> Right click on "MyApp" -> Properties
    Automagically MyApp Properties Pages window opens
    Select: Configuration "All Configurations"
    Select: Configuration Properties -> C/C++ -> General -> Additional
Include Directories
      and specify: C:\MyFirstAttempt\curl-7.16.2\include\curl
    Press Button "Apply"
    Press Button "Accept"
15) From within VC8 Solution Explorer -> Right click on "MyApp" -> Properties
    Automagically MyApp Properties Pages window opens
    Select: Configuration "Debug"
    Select: Configuration Properties -> Linker -> General ->
Additional Library Directories
      and specify: C:\MyFirstAttempt\curl-7.16.2\lib\Debug
    Press Button "Apply"
    Select: Configuration "Release"
    Select: Configuration Properties -> Linker -> General ->
Additional Library Directories
      and specify: C:\MyFirstAttempt\curl-7.16.2\lib\Release
    Press Button "Apply"
    Select: Configuration "All Configurations"
    Select: Configuration Properties -> Linker -> Input -> Additional
Dependencies
      and add: curllib.lib <<< watch out the double L and type it
right !!!!!!!!!!!!
      and add: ws2_32.lib
      and add: winmm.lib
    Press Button "Apply"
    Press Button "Accept"
16) From within VC8 main menu -> File -> Save All (Just in case the
light goes out)
17) From within VC8 main menu -> Build -> Batch Build -> Select All ->
Build -> Save

And ...

========== Build: 4 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

-- 
-=[Yang]=-

Received on 2007-04-11