Configuring a Sample Project

  1. Obtain the huaweicloud-sdk-dis-c-XXX.zip development package from SDK Download and upload it to any directory in Linux. Go to the directory and run the unzip huaweicloud-sdk-dis-c-XXX.zip command to decompress the package. The package contains the dis-source folder (source code), sample folder (sample code), and third_party folder (third-party class) are displayed.
  2. Go to the dis-source/src directory and run the protoc-c --c_out=. httpbody.proto command. The httpbody.pb-c.c and httpbody.pb-c.h files are generated in the current directory.
  3. Return to the dis-source folder and run the make command to compile source codes.

    The warning information generated during command execution will not adversely affect the program. After the command is executed, a build folder is generated to store the dynamic link library.

  4. Run the ./build.sh command.

    The following information is displayed in the command output:

    -bash: ./build.sh: /bin/bash^M: bad interpreter: No such file or directory

    Run the following commands:

    chmod 700 ./build.sh

    vim build.sh

    :set ff=unix

    :wq!

    The warning information generated during command execution will not adversely affect the program. After the command is executed, a dis_api folder is generated. Files in this folder are required for executing the sample code.

  5. Go to the sample folder and modify the DIS parameters in test.c, such as ak, sk, and projectId.
  6. Run the make command to compile the program and generate the executable file dis_bin.
  7. Run the ./dis_bin command to check the running result of the program.