Thread: anyone compiled this code in windows: ftpupload.c ??!

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    34

    Lightbulb anyone compiled this code in windows: ftpupload.c ??!

    Hi all,
    this is an example of cURL from http://http://curl.haxx.se/
    i didn't met anyone compiled this code in window and work well

    many people got problems with this code, or many codes of this library cURL
    this is code page:
    libcurl - ftpupload.c

    i tried to compile it in Borland c++, Dev c++, Turbo c++, cygwin, VC++6, VC++ 2005, VC++ 2010... i couldn't compile it really

    please if anyone can compile it in windows share it how please

    i got tired with that

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So pick one compiler (say vc2010), create a new (and empty) win32 console project and paste in that code into a new .c file (not the default main.cpp the compiler gives you).

    Then compile it, and maybe post some actual error messages.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bakri View Post
    i tried to compile it in Borland c++, Dev c++, Turbo c++, cygwin, VC++6, VC++ 2005, VC++ 2010... i couldn't compile it really
    It's not C++ dilly.

    You need "printf_macro.h" in the same directory:
    /vendor/curl/current/docs/examples/printf_macro.h

    Also, you need to link to libcurl.

    gcc -Wall -pedantic ftpupload.c -lcurl

    Compiled fine. If you have cygwin you probably have gcc.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    i went to the page:
    cURL - Download

    but i couldn't download it..

    am using cygwin, i went to cygwin section: Win32 - cygwin
    it gives me url: Cygwin Package List
    i went to cygwin Net and installed curl but can't use it, also i didn't find curl:
    curl/curl.h: No such file or directory

    i want download link
    help me please

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you want this to run in cygwin, the easiest thing to do is run the setup.exe and just select the "curl development" package.
    This will download and install it in the correct place for you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    i did it really.. but i couldn't find folder curl

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    ok... i manually copied the folder curl from .rar file.. when typed:
    Code:
    gcc -Wall -pedantic ftpupload.c -lcurl
    i got this output:
    Code:
    Code:
    ftp.c: In function `main':
    ftp.c:83: warning: ISO C90 does not support the `ll' printf length modifier
    ftp.c:83: warning: ISO C90 does not support the `ll' printf length modifier
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lcurl
    collect2: ld returned 1 exit status

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well the header files will be in /usr/include/curl and the libraries are in /usr/lib

    So you should be able to just type
    gcc ftpupload.c -lcurl

    I don't know what that printf_macro.h file is all about, but all I needed to do was this to get it to compile
    Code:
    //#include "printf_macro.h"
    #define _FMT_SIZE_T "%lu"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    how to add library? just copy it from .rar to /usr/ or what ?
    Code:
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lcurl
    collect2: ld returned 1 exit status

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    What .rar file?

    Did you run setup.exe ?
    Did you select "curl development" ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    yes i did it in setup.exe
    when i try to compile my file ftp.c
    return:
    Code:
    curl/curl.h: No such file or directory
    then i downloaded file: curl_7.22.0.orig.tar.gz
    and copied folder curl to:
    Code:
    F:\cygwin\home\PC5
    where i installed the cygwin

    and my file ftp.c in:
    Code:
    F:\cygwin\home\PC5\ftp.c

  12. #12
    Registered User
    Join Date
    Mar 2012
    Posts
    34
    i deleted directory cygwin and installed it again from setup.exe.. it's compile fine but got error when opening the output file a.exe
    this link:

    this application has failed to start because cygwincurl-4.dll was not found? Help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 02-15-2012, 08:46 PM
  2. Compiled code crashing
    By cMacD in forum C Programming
    Replies: 7
    Last Post: 11-10-2011, 06:04 PM
  3. Weird access to an exe compiled with windows.h
    By _izua_ in forum C++ Programming
    Replies: 8
    Last Post: 08-12-2007, 03:43 PM
  4. C# Compiled to Machine Code
    By FwyWice in forum C# Programming
    Replies: 1
    Last Post: 12-06-2002, 04:22 AM
  5. compiled under windows, work for mac os?
    By Shadow12345 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2002, 09:55 AM

Tags for this Thread