Использование libcurl в приложении C++ для Android с использованием CMakeAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Использование libcurl в приложении C++ для Android с использованием CMake

Сообщение Anonymous »

Возможно, на этом форуме уже есть ответы по этой проблеме, но я уже перепробовал много решений, но так и не решил эту проблему.
Я должен сделать приложение для Android, использующее C++, которое использует libcurl.
И что бы я ни делал, я не могу запустить свою программу, потому что она не находит библиотеку.
В моем .cpp я использую эту строку:

Код: Выделить всё

#include 
А это мой CMakeLists.txt

Код: Выделить всё

# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds it for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
native-lib

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
src/main/cpp/native-lib.cpp )

# Searches for a specified prebuilt library and stores the path as a
# variable. Because system libraries are included in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
log-lib
-lcurl

# Specifies the name of the NDK library that
# you want CMake to locate.
log
-lcurl )

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in the
# build script, prebuilt third-party libraries, or system libraries.

INCLUDE_DIRECTORIES($/usr/include/)

target_link_libraries( # Specifies the target library.
native-lib
-lcurl

# Links the target library to the log library
# included in the NDK.
${log-lib} )
Я использовал команды:

Код: Выделить всё

sudo aptitude install libcurl4-gnutls-dev
и

Код: Выделить всё

sudo aptitude install libcurl-dev


Подробнее здесь: https://stackoverflow.com/questions/416 ... sing-cmake
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»