[Programming recipe] how to compile the simplest curl example in Ubuntu

Source: Internet
Author: User
Tags curl api

Introduction: I haven't fought in a Linux environment for a while. I just need to study the curl API usage. I tried to compile a simple curl example and found many problems, finally, I decided to record the process to avoid making similar simple mistakes in the future. It would be a blessing to help a passer-by!

 Ingredients:

  • Ubuntu 12.04 64-bit has installed basic GCC, G ++, and make.
  • Simple. c is the simplest C instance of curl on the official website.

Procedure:

1. First install the curl Development Environment

Sudo apt-Get install libcurl4-openssl-dev

2. Compile the link.

GCC simple. C-lcurl-o simple

3. Run it.

./Simple

Tips:

The default link directory may be placed in three places:

  • /Etc/lD. So. conf
  • /Etc/lD. So. conf. d/
  • Environment Variable LD_LIBRARY_PATH

If the Linked Library is not in the default path, you can also use the GCC parameter, such as-L/Some/path/lib.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.