cURL / Mailing Lists / curl-library / Single Mail

curl-library

Build Curl Library with Visual Studio 2005 *short version*;)

From: <Surfman19_at_gmx.at>
Date: Mon, 17 Apr 2006 23:29:40 +0200 (MEST)

Hello,
here my short tutorial to build curl-7.15.3 library with visual studio 2005!

1.) Build the curl-7.15.3 library:

changes in lib/config-win32.h
#define HAVE_SSL_H 1 <--- because i want to use ssl

Project Settings:
Preprocessor Definitions:
WIN32
_DEBUG
_WINDOWS
_USRDLL
BUILDING_LIBCURL
USE_SSLEAY <--- only needed for ssl
USE_OPENSSL <--- only needed for ssl
DCURL_STATICLIB

Additional Dependencies: "ws2_32.lib winmm.lib libeay32.lib ssleay32.lib
                                               ... only needed for ssl ...

2.) Testcode:
#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    /* First set the URL that is about to receive our POST. This URL can
       just as well be a https:// URL if that is what should receive the
       data. */
    curl_easy_setopt(curl, CURLOPT_URL,
"http://www.rafb.net/paste/paste.php");
    /* Now specify the POST data */
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
"lang=C%2B%2B&nick=&desc=&cvt_tabs=No&text=curlTest;)");

    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}

3.) Configurations for the Testcode Project:
Preprocessor Definitions:
WIN32
_DEBUG
_CONSOLE
CURL_STATICLIB

Additional Dependencies: curllib.lib

4.) Compile Result:
------ Rebuild All started: Project: curl_test, Configuration: Debug Win32
------
Deleting intermediate and output files for project 'curl_test',
configuration 'Debug|Win32'
Compiling...
main.cpp
Compiling manifest to resources...
Linking...
Starting pass 1
Processed /DEFAULTLIB:uuid.lib
Processed /DEFAULTLIB:MSVCRTD
Processed /DEFAULTLIB:OLDNAMES
Searching libraries
    Searching C:\curl-7.15.3\lib\Debug\curllib.lib:
      Found _curl_easy_cleanup
        Referenced in main.obj
        Loaded curllib.lib(easy.obj)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: _free already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined
in MSVCRTD.lib(MSVCR80D.dll)
      Found __tolower_l
        Referenced in LIBCMTD.lib(stricmp.obj)
        Referenced in LIBCMTD.lib(strnicmp.obj)
        Loaded LIBCMTD.lib(tolower.obj)
LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in
MSVCRTD.lib(MSVCR80D.dll)
        Loaded LIBCMTD.lib(setlocal.obj)
LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already
defined in MSVCRTD.lib(MSVCR80D.dll)
        Loaded LIBCMTD.lib(tidtable.obj)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined
in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined
in MSVCRTD.lib(MSVCR80D.dll)
        Loaded LIBCMTD.lib(lseeki64.obj)
LIBCMTD.lib(lseeki64.obj) : error LNK2005: __lseeki64 already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __umaskval
        Referenced in LIBCMTD.lib(open.obj)
        Loaded LIBCMTD.lib(crt0dat.obj)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __get_fmode
        Referenced in LIBCMTD.lib(open.obj)
        Loaded LIBCMTD.lib(setmode.obj)
LIBCMTD.lib(setmode.obj) : error LNK2005: __setmode already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found ___crtwsetenv
        Referenced in LIBCMTD.lib(putenv.obj)
        Loaded LIBCMTD.lib(wsetenv.obj)
      Found __pfnAllocHook
        Referenced in LIBCMTD.lib(dbgheap.obj)
        Loaded LIBCMTD.lib(dbghook.obj)
LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already
defined in MSVCRTD.lib(MSVCR80D.dll)
      Found ___sbh_verify_block
        Referenced in LIBCMTD.lib(dbgheap.obj)
        Loaded LIBCMTD.lib(sbheap.obj)
      Found _sprintf_s
        Referenced in LIBCMTD.lib(dbgheap.obj)
        Loaded LIBCMTD.lib(sprintf.obj)
LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __chvalidator_l
        Referenced in LIBCMTD.lib(dbgheap.obj)
        Referenced in LIBCMTD.lib(tolower.obj)
        Loaded LIBCMTD.lib(isctype.obj)
LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __mtinitlocks
        Referenced in LIBCMTD.lib(tidtable.obj)
        Loaded LIBCMTD.lib(mlock.obj)
LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __XcptActTab
        Referenced in LIBCMTD.lib(tidtable.obj)
        Loaded LIBCMTD.lib(winxfltr.obj)
LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found ___crtInitCritSecAndSpinCount
        Referenced in LIBCMTD.lib(osfinfo.obj)
        Referenced in LIBCMTD.lib(ioinit.obj)
        Referenced in LIBCMTD.lib(mlock.obj)
        Loaded LIBCMTD.lib(initcrit.obj)
      Found ___app_type
        Referenced in LIBCMTD.lib(osfinfo.obj)
        Loaded LIBCMTD.lib(crt0.obj)
LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in
MSVCRTD.lib(crtexe.obj)
      Found ___xt_a
        Referenced in LIBCMTD.lib(crt0dat.obj)
        Loaded LIBCMTD.lib(crt0init.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
MSVCRTD.lib(cinitexe.obj)
LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
MSVCRTD.lib(cinitexe.obj)
      Found __initp_eh_hooks
        Referenced in LIBCMTD.lib(crt0dat.obj)
        Loaded LIBCMTD.lib(hooks.obj)
      Found __initp_misc_winsig
        Referenced in LIBCMTD.lib(crt0dat.obj)
        Loaded LIBCMTD.lib(winsig.obj)
LIBCMTD.lib(winsig.obj) : error LNK2005: _signal already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found _atol
        Referenced in LIBCMTD.lib(getqloc.obj)
        Referenced in LIBCMTD.lib(convrtcp.obj)
        Referenced in LIBCMTD.lib(tzset.obj)
        Loaded LIBCMTD.lib(atox.obj)
LIBCMTD.lib(atox.obj) : error LNK2005: _atoi already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __set_error_mode
        Referenced in LIBCMTD.lib(crt0msg.obj)
        Loaded LIBCMTD.lib(errmode.obj)
LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found ___crtGetLocaleInfoW
        Referenced in LIBCMTD.lib(inithelp.obj)
        Loaded LIBCMTD.lib(w_loc.obj)
      Found ___crtMessageWindowW
        Referenced in LIBCMTD.lib(dbgrptt.obj)
        Loaded LIBCMTD.lib(dbgrptw.obj)
LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __getbuf
        Referenced in LIBCMTD.lib(_flsbuf.obj)
        Loaded LIBCMTD.lib(_getbuf.obj)
      Found __fileno
        Referenced in LIBCMTD.lib(_flsbuf.obj)
        Referenced in LIBCMTD.lib(output.obj)
        Loaded LIBCMTD.lib(fileno.obj)
      Found __get_printf_count_output
        Referenced in LIBCMTD.lib(output.obj)
        Loaded LIBCMTD.lib(printf.obj)
      Found _wctomb_s
        Referenced in LIBCMTD.lib(output.obj)
        Loaded LIBCMTD.lib(wctomb.obj)
      Found __output_p_l
        Referenced in LIBCMTD.lib(vsprintf.obj)
        Referenced in LIBCMTD.lib(vsnprnc.obj)
        Loaded LIBCMTD.lib(outputp.obj)
      Found __output_s_l
        Referenced in LIBCMTD.lib(vsnprnc.obj)
        Loaded LIBCMTD.lib(outputs.obj)
      Found ___crtGetStringTypeW
        Referenced in LIBCMTD.lib(iswctype.obj)
        Loaded LIBCMTD.lib(w_str.obj)
      Found "long __stdcall __CxxUnhandledExceptionFilter(struct
_EXCEPTION_POINTERS *)"
(?__CxxUnhandledExceptionFilter@@YGJPAU_EXCEPTION_POINTERS@@@Z)
        Referenced in LIBCMTD.lib(frame.obj)
        Loaded LIBCMTD.lib(unhandld.obj)
      Found "int __cdecl _ValidateRead(void const *,unsigned int)"
(?_ValidateRead@@YAHPBXI_at_Z)
        Referenced in LIBCMTD.lib(frame.obj)
        Loaded LIBCMTD.lib(validate.obj)
      Found __CxxThrowException_at_8
        Referenced in LIBCMTD.lib(frame.obj)
        Loaded LIBCMTD.lib(throw.obj)
      Found "const type_info::`vftable'" (??_7type_info@@6B@)
        Referenced in LIBCMTD.lib(frame.obj)
        Loaded LIBCMTD.lib(typinfo.obj)
      Found "public: __thiscall std::exception::exception(class
std::exception const &)" (??0exception_at_std@@QAE_at_ABV01@@Z)
        Referenced in LIBCMTD.lib(frame.obj)
        Loaded LIBCMTD.lib(stdexcpt.obj)
      Found "void __cdecl operator delete(void *)" (??3_at_YAXPAX@Z)
        Referenced in LIBCMTD.lib(frame.obj)
        Referenced in LIBCMTD.lib(typinfo.obj)
        Referenced in LIBCMTD.lib(stdexcpt.obj)
        Loaded LIBCMTD.lib(dbgdel.obj)
      Found __NLG_Notify
        Referenced in LIBCMTD.lib(lowhelpr.obj)
        Loaded LIBCMTD.lib(exsup.obj)
      Found __getenv_helper_nolock
        Referenced in LIBCMTD.lib(tzset.obj)
        Loaded LIBCMTD.lib(getenv.obj)
LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __strtol_l
        Referenced in LIBCMTD.lib(atox.obj)
        Loaded LIBCMTD.lib(strtol.obj)
LIBCMTD.lib(strtol.obj) : error LNK2005: _strtol already defined in
MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(strtol.obj) : error LNK2005: _strtoul already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __strtoi64_l
        Referenced in LIBCMTD.lib(atox.obj)
        Loaded LIBCMTD.lib(strtoq.obj)
LIBCMTD.lib(strtoq.obj) : error LNK2005: __strtoi64 already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found ___crtMessageBoxW
        Referenced in LIBCMTD.lib(dbgrptw.obj)
        Loaded LIBCMTD.lib(crtmboxw.obj)
      Found __ismbblead_l
        Referenced in LIBCMTD.lib(mbsnbcpy_s_l.obj)
        Loaded LIBCMTD.lib(ismbbyte.obj)
      Found __cflush
        Referenced in LIBCMTD.lib(_getbuf.obj)
        Loaded LIBCMTD.lib(_file.obj)
LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found __ftbuf
        Referenced in LIBCMTD.lib(printf.obj)
        Loaded LIBCMTD.lib(_sftbuf.obj)
      Found __vprintf_l
        Referenced in LIBCMTD.lib(printf.obj)
        Loaded LIBCMTD.lib(vprintf.obj)
      Found "private: static char const * __cdecl
type_info::_Name_base(class type_info const *,struct __type_info_node *)"
(?_Name_base_at_type_info@@CAPBDPBV1_at_PAU__type_info_node@@@Z)
        Referenced in LIBCMTD.lib(typinfo.obj)
        Loaded LIBCMTD.lib(typname.obj)
      Found __fcloseall
        Referenced in LIBCMTD.lib(_file.obj)
        Loaded LIBCMTD.lib(closeall.obj)
      Found __flushall
        Referenced in LIBCMTD.lib(_file.obj)
        Loaded LIBCMTD.lib(fflush.obj)
LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in
MSVCRTD.lib(MSVCR80D.dll)
      Found ___unDName
        Referenced in LIBCMTD.lib(typname.obj)
        Loaded LIBCMTD.lib(undname.obj)
      Found __set_abort_behavior
        Referenced in LIBCMTD.lib(purevirt.obj)
        Loaded LIBCMTD.lib(abort.obj)
LIBCMTD.lib(abort.obj) : error LNK2005: _abort already defined in
MSVCRTD.lib(MSVCR80D.dll)
    Searching C:\Programme\Microsoft Visual Studio 8\VC\lib\MSVCRT.lib:
      Found __imp___stat32
        Referenced in OLDNAMES.lib(stat.obi)
        Loaded MSVCRT.lib(MSVCR80.dll)
      Found __imp___chmod
        Referenced in OLDNAMES.lib(chmod.obi)
        Loaded MSVCRT.lib(MSVCR80.dll)
      Found __imp___fileno
        Referenced in OLDNAMES.lib(fileno.obi)
        Loaded MSVCRT.lib(MSVCR80.dll)
MSVCRT.lib(MSVCR80.dll) : error LNK2005: __fileno already defined in
LIBCMTD.lib(fileno.obj)
      Found __imp___getch
        Referenced in OLDNAMES.lib(getch.obi)
        Loaded MSVCRT.lib(MSVCR80.dll)
      Found "public: virtual void * __thiscall type_info::`vector deleting
destructor'(unsigned int)" (??_Etype_info@@UAEPAXI_at_Z)
        Referenced in LIBCMTD.lib(typinfo.obj)
        Loaded MSVCRT.lib(ti_inst.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
type_info::type_info(class type_info const &)" (??0type_info@@AAE_at_ABV0@@Z)
already defined in LIBCMTD.lib(typinfo.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info &
__thiscall type_info::operator=(class type_info const &)"
(??4type_info@@AAEAAV0_at_ABV0@@Z) already defined in

LIBCMTD.lib(typinfo.obj)
      Found __IMPORT_DESCRIPTOR_MSVCR80
        Referenced in MSVCRT.lib(MSVCR80.dll)
        Referenced in MSVCRT.lib(MSVCR80.dll)
        Referenced in MSVCRT.lib(MSVCR80.dll)
        Referenced in MSVCRT.lib(MSVCR80.dll)
        Loaded MSVCRT.lib(MSVCR80.dll)
      Found "void __stdcall `eh vector destructor iterator'(void *,unsigned
int,int,void (__thiscall*)(void *))" (??_M_at_YGXPAXIHP6EX0@Z_at_Z)
        Referenced in MSVCRT.lib(ti_inst.obj)
        Loaded MSVCRT.lib(ehvecdtr.obj)
      Found MSVCR80_NULL_THUNK_DATA
        Referenced in MSVCRT.lib(MSVCR80.dll)
        Loaded MSVCRT.lib(MSVCR80.dll)
      Found __SEH_epilog4
        Referenced in MSVCRT.lib(ehvecdtr.obj)
        Loaded MSVCRT.lib(sehprolg4.obj)
    Searching C:\curl-7.15.3\lib\Debug\curllib.lib:
    Searching C:\Programme\Microsoft Visual Studio 8\VC\lib\kernel32.lib:
      Found __imp__InterlockedExchange_at_8
        Referenced in MSVCRTD.lib(crtexe.obj)
        Referenced in LIBCMTD.lib(setmode.obj)
        Referenced in LIBCMTD.lib(rand_s.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other
libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
Finished pass 1
Generating non-SAFESEH image.
Invoking CVTRES.EXE:
 /machine:x86
 /verbose
 /out:"C:\DOKUME~1\Gerald\LOKALE~1\Temp\lnkE4.tmp"
 /readonly
 ".\Debug\curl_test.exe.embed.manifest.res"
Microsoft (R) Windows Resource To Object Converter Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
adding resource. type:MANIFEST, name:1, language:0x0409, flags:0x30,
size:2048
c:\curl_test\Debug\curl_test.exe : fatal error LNK1169: one or more multiply
defined symbols found
curl_test - 44 error(s), 3 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

5.) Fixing this Problem:
Change the Project Settings:
-> Ignore Specific Library: libcmtd

6.) Compiler Result:
curl_test - 0 error(s), 1 warning(s)

7.) Run the Program

8.) Got to http://www.rafb.net/paste/results.html
and look for latest the paste:
04/17/2006 17:05 C++ Anonymous No description

9.) it works;))

greets Gerald

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
Received on 2006-04-17