Ubuntu - #include no such file or directory

后端 未结 4 786
盖世英雄少女心
盖世英雄少女心 2021-01-02 23:25

I\'m developping a C-program using Curl on Ubuntu. I\'m using Eclipse Kepler. I have installed the curl library using

apt-get install libcurl4-gnutls-dev

相关标签:
4条回答
  • 2021-01-02 23:48

    Make sure that you've got curl.h installed to your default location (LD_LIBRARY_PATH). If you don't, you can clone and install from GitHub.

    Once you've cloned it, just use these commands:

    ./buildconf
    ./configure
    make
    cd include # ONLY install the include folder (with curl.h, etc)
    make install
    

    And you should be done. If you need further help, check the GIT-INFO file in the base directory.

    0 讨论(0)
  • 2021-01-02 23:54

    C compilers' (preprocessors', actually) standard include file searching paths should include /usr/include, therefore if the include file curl.h is located in /usr/include/curl/ and is included by #include <curl/curl.h>, C compilers, such as gcc, should be able to find it without any problem.

    However, you are using a toolchain under /opt/toolchains/arm-2011.V2/bin, I guess it is a cross-compiling toolchain. In this case, you cannot use the curl library, because which is for the host system, which probably is a x86 or x86_64 system.

    To use curl library in your ARM project, you need to install the curl library development package for ARM, if that is possible. If the software repositories do not have those packages, then you need to download the source code and cross-compile it for ARM first.

    0 讨论(0)
  • 2021-01-02 23:54

    This fixed it for me:

    sudo ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
    
    0 讨论(0)
  • 2021-01-03 00:01

    Try to use this. Find your curl.h file - it shoud be where you installed your curl '...\include\curl\curl.h' So instead of writing in your code this '#include ', write all path like here '#include '. It is possible to help you! Good luck )

    0 讨论(0)
提交回复
热议问题