Help Center> Object Storage Service> C> FAQs> Common Compile Errors
Updated on 2024-02-02 GMT+08:00

Common Compile Errors

This section lists some compilation errors you may encounter when you compile an SDK or SDK demo. Some earlier versions may also have such errors.

Errors in Version 3.23.3:

Error 1:

An error occurs in the Visual Studio (VS) project for compiling SDK.

Error files: eSDKLogAPI.h and eSDKLogDataType.h in the ${yourSDKPath}\platform\eSDK_LogAPI_V2.1.10\C\include directory

VS compiler error: c2018

Solution:

Change the end of line (EOL) sequence in files eSDKLogAPI.h and eSDKLogDataType.h to CRLF.

Error 2:

After the VS project successfully compiles the SDK, lib and dll must be manually copied to the project directory demo for the demo program to run, which is inconvenient.

Solution (with Debug and x64 Configured):

1. Compile the obs.sln file that has Debug and x64 configured.

2. Open obs_demo.sln, set Properties to Debug and x64, and enter the following value:

PATH=%PATH%;$(ProjectDir)..\..\eSDK_OBS_API_C++\build\vc100\Debug;$(ProjectDir)..\..\eSDK_OBS_API_C++\bin\win64_x64_msvc\release;$(ProjectDir)..\..\..\..\platform\eSDK_LogAPI_V2.1.10\C\release_x64;$(LocalDebuggerEnvironment)

Errors in SDK 3.22.7

Error 1:

Solution: Execute the following script to compile the securec component and copy the result to the corresponding directory:

export Your_SDK_path='Your_SDK_path'

cd ${Your_SDK_path}/platform/huaweisecurec/src/

make

mkdir ${Your_SDK_path}/platform/huaweisecurec/lib/linux

cp ${Your_SDK_path}/platform/huaweisecurec/lib/libsecurec.so ${Your_SDK_path}/platform/securec/lib/linux

cd ${Your_SDK_path}/source/eSDK_OBS_API/eSDK_OBS_API_C++

#Run the cd command to go to the directory, because the script searches for dependencies by relative path.

sh build.sh

Error 2:

Solution:

In the download_file.c file under source\eSDK_OBS_API\eSDK_OBS_API_C++\src\object\:

Delete lines 26 and 27:

pthread_mutex_t g_mutexThreadCheckpoint;

pthread_mutex_t g_mutexThreadCheckpoint_download;

In the object_common.c file under source\eSDK_OBS_API\eSDK_OBS_API_C++\src\object\:

Delete lines 31 and 32:

pthread_mutex_t g_mutexThreadCheckpoint;

pthread_mutex_t g_mutexThreadCheckpoint_download;

Compile the file.

Error 3:

Generally, this error occurs when the build.sh script is executed in another path. Because the script searches for dependencies based on the relative path, you need to run the cd command to go to the corresponding directory and then run the build.sh script. Run the following script for compilation:

export Your_SDK_path='Your_SDK_path'

cd ${Your_SDK_path}/source/eSDK_OBS_API/eSDK_OBS_API_C++

sh build.sh

SDK Demo Errors in Version 3.22.7

Error 1:

Copy the cjson header file and relevant libraries. (If Arm is used, replace linux in the path with arm.)

In addition, modify the Makefile file.

export Your_SDK_path='Your_SDK_path'

export Your_DEMO_path='Your_DEMO_path'

cp ${Your_SDK_path}/build/script/Provider/build/linux/cjson-1.7.15/include/cJSON.h ${Your_DEMO_path}/include

cp ${Your_SDK_path}/build/script/Provider/build/linux/cjson-1.7.15/lib/libcjson.so* ${Your_DEMO_path}/lib

Open the Makefile file under ${Your_DEMO_path}/demo/.

In line 16, replace LIB=-leSDKOBS -lsecurec with LIB=-lcjson -leSDKOBS -lsecurec.

cd ${Your_DEMO_path}/demo

make