This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new ff6d733  add the content of cpp compile error (#187)
ff6d733 is described below

commit ff6d7332ebe51f4f7120354c9b0b0e94981ea33b
Author: wanghui42 <[email protected]>
AuthorDate: Thu Mar 7 12:02:51 2024 +0800

    add the content of cpp compile error (#187)
---
 .../Master/API/Programming-Cpp-Native-API.md       | 616 +++++++++++++++------
 .../latest/API/Programming-Cpp-Native-API.md       | 311 +++++++++++
 .../Master/API/Programming-Cpp-Native-API.md       | 314 ++++++++++-
 .../latest/API/Programming-Cpp-Native-API.md       | 310 +++++++++++
 4 files changed, 1373 insertions(+), 178 deletions(-)

diff --git a/src/UserGuide/Master/API/Programming-Cpp-Native-API.md 
b/src/UserGuide/Master/API/Programming-Cpp-Native-API.md
index 6302bfc..41b9f8c 100644
--- a/src/UserGuide/Master/API/Programming-Cpp-Native-API.md
+++ b/src/UserGuide/Master/API/Programming-Cpp-Native-API.md
@@ -22,16 +22,14 @@
 # C++ Native API
 
 ## Dependencies
-
 - Java 8+
-- Maven 3.9+ (optional when using `mvnw` command)
+- Maven 3.5+
 - Flex
 - Bison 2.7+
 - Boost 1.56+
 - OpenSSL 1.0+
 - GCC 5.5.0+
 
-> Even if we'll be building a C++ application, we still need `Maven` for the 
build and that requires `Java`
 
 ## Installation From Source Code
 
@@ -39,46 +37,50 @@
 
 - **MAC**
 
-    1. Install Homebrew, as we'll be installing all dependencies via that.
-        ```shell
-        /bin/bash -c "$(curl -fsSL 
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-        ``` 
-    2. Make sure java ist installed, if not:
-        ```shell
-        brew install java
-        ``` 
-       Please pay attention to the output of the installation process. 
-       It will probably note that you need to create a symlink:
-        1. On Intel-based models:
-           ```shell
-           sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk 
/Library/Java/JavaVirtualMachines/openjdk.jdk
-           ``` 
-        2. On Arm-based models 
-           ```shell
-           sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk 
/Library/Java/JavaVirtualMachines/openjdk.jdk
-           ``` 
-    3. Install Bison:Bison 2.3 is preinstalled on OSX, but this version is 
outdated, and we need a newer version.
+    1. Install Bison :Bison 2.3 is preinstalled on OSX, but this version is 
too low.
+
+       When building Thrift with Bison 2.3, the following error would pop out:
+       ```invalid directive: '%code'```
+
+       For such case, please update `Bison`:
        ```shell
        brew install bison
+       brew link bison --force
        ```
-    4. Install Boost:Please make sure a relative new version of Boost is ready 
on your machine.
-         If no Boost available, install the latest version of Boost:
-       ```shell
-       brew install boost
-       ```
-    5. OpenSSL :Make sure the Openssl header files and libraries have been 
installed on your Mac. The default Openssl include file search path is 
"/usr/local/opt/openssl/include".
-       ```shell
-       brew install openssl
-       ```
+       
+       Then, you need to tell the OS where the new bison is.
+    
+          For Bash users:
+          ```shell
+          echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> 
~/.bash_profile
+          ```
+
+          For zsh users:
+          ```shell
+          echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.zshrc
+          ```
+
+    2. Install Boost :Please make sure a relative new version of Boost is 
ready on your machine.
+       If no Boost available, install the latest version of Boost:
+          ```shell
+          brew install boost
+          brew link boost
+          ```
+
+    3. OpenSSL :Make sure the Openssl libraries has been install on your Mac. 
The default Openssl include file search path is 
"/usr/local/opt/openssl/include".
+
+       If Openssl header files can not be found when building Thrift, please 
add option`-Dopenssl.include.dir=""`.
+
 
 - **Ubuntu 20**
 
   To install all dependencies, run:
 
     ```shell
-    sudo apt install default-jdk bison flex libboost-all-dev libssl-dev
+    sudo apt-get install gcc-9 g++-9 libstdc++-9-dev bison flex 
libboost-all-dev libssl-dev zlib1g-dev
     ```
 
+
 - **CentOS 7.x**
 
   Some packages can be installed using Yum:
@@ -89,93 +91,398 @@
 
   The version of gcc and boost installed by yum is too low, therefore you 
should compile or download these binary packages by yourself.
 
+
 - **Windows**
 
-    1. Install Chocolatey, as we'll be installing all dependencies via that: 
[Installation Instructions](https://chocolatey.org/install) 
+    1. Building environment
+        * Install `MS Visual Studio`(recommend 2019 version): remember to 
install Visual Studio C/C++ IDE and compiler(supporting CMake, Clang, MinGW).
+        * Download and install [CMake](https://cmake.org/download/) .
 
-    2. Make sure Java is installed, if not:
-       ```shell
-       choco install openjdk
-       ```
-       > Note on Windows running on aarch64 machines, the chocolatey script 
has been seen to install an x86_64 version of the JDK instead, which will still 
work, but at a low-performance, as it'll be running in emulation-mode. 
Currently, however aarch64 is a bit of a problem and will hopefully be fully 
supported in future versions of the cmake-maven-plugin.
+    2. Download and install `Flex` & `Bison`
+        * Download 
[Win_Flex_Bison](https://sourceforge.net/projects/winflexbison/) .
+        * After downloaded, please rename the executables to `flex.exe` and 
`bison.exe` and add them to "PATH" environment variables.
 
-    3. Install Visual Studio 19 2022:
-       ```shell
-       choco install visualstudio2022community
-       choco install visualstudio2022buildtools
-       choco install visualstudio2022-workload-nativedesktop
-       ```
-       
-    4. Install Flex and Bison:
-       ```shell
-       choco install winflexbison
-       ```
+    3. Install `Boost`
+        * Download [Boost](https://www.boost.org/users/download/) .
+        * Then build `Boost` by executing bootstrap.bat and b2.exe.
 
-     5. Install `Boost`:
-        ```shell
-        choco install boost-msvc-14.2
-        ```
+    4. Install `OpenSSL`
+        * Download and install 
[OpenSSL](http://slproweb.com/products/Win32OpenSSL.html) .
 
-     6. Install `OpenSSL`:
-        ```shell
-        choco install openssl
-        ```
 
 ### Compile
 
-You can download the source code from the [IoTDB 
Website](https://iotdb.apache.org/Download/) or clone the GIT repository:
+You can download the source code from:
 ```shell
 git clone https://github.com/apache/iotdb.git
 ```
 
-The default dev branch is the master branch, If you want to use a released 
version (e.g. `0.13.3` or `1.2.0`), be sure to check out the corresponding tag:
+The default dev branch is the master branch, If you want to use a released 
version (eg. `rel/0.13`):
 ```shell
-git checkout v0.13.3
+git checkout rel/0.13
 ```
-(Please note that we are using a `Go` compatible naming schema for our release 
tags, which prefixes the version by a `v`)
 
-> If you want to use the `maven-wrapper` which will automatically fetch the 
right version of `Maven`, replace `mvn` with `./mvnw` on Mac and Linux and 
`mvnw.cmd` on Windows systems.
+Under the root path of iotdb:
 
-In order to compile the project, execute the following command in the root 
path of the project:
+- Mac & Linux
+    ```shell
+    mvn package -P compile-cpp -pl example/client-cpp-example -am -DskipTest
+    ```
+
+- Windows
+    ```shell
+    mvn package -P compile-cpp -pl 
iotdb-client/client-cpp,iotdb-core/datanode,example/client-cpp-example -am 
-Dcmake.generator="your cmake generator" -Dboost.include.dir=${your boost 
header folder} -Dboost.library.dir=${your boost lib (stage) folder} -DskipTests
+    ```
+    - When building client-cpp project, use `-Dcmake.generator=""` option to 
specify a Cmake generator. E.g. `-Dcmake.generator="Visual Studio 16 2019"` 
(`cmake --help` shows a long list of supported Cmake generators.)
+    - To help CMake find your Boost libraries on windows, you should set 
`-DboostIncludeDir="C:\Program Files (x86)\boost_1_78_0" 
-DboostLibraryDir="C:\Program Files (x86)\boost_1_78_0\stage\lib"` to your mvn 
build command.
+    ``
+
+If the compilation finishes successfully, the packaged zip file will be placed 
under `client-cpp/target/client-cpp-1.3.0-SNAPSHOT-cpp-${os}.zip`
+
+### Compile Q&A
+
+Q:How to deal with compile error`undefined reference to '_libc_sinle_thread'`?
+
+A:
+- Delete the test-related compilation and running operations in the pom.xml of 
C++client. The modified pom is as follows:
 
-```shell
-mvn package -P with-cpp -pl example/client-cpp-example, -am -DskipTest
 ```
+      
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.iotdb</groupId>
+        <artifactId>iotdb-client</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>client-cpp</artifactId>
+    <packaging>pom</packaging>
+    <name>IoTDB: Client: Client for CPP</name>
+    <description>C++ client</description>
+    <!-- TODO: The tests don't run, if distribution has not been built locally 
and fails without reasoning -->
+    <properties>
+        <catch2.url>https://alioss.timecho.com/upload/catch.hpp</catch2.url>
+        <cmake.build.type>Release</cmake.build.type>
+        <!-- Default value of cmake root -->
+        
<cmake.root.dir>${project.build.directory}/dependency/cmake/</cmake.root.dir>
+        
<thrift.exec.absolute.path>${project.build.directory}/thrift/bin/${thrift.executable}</thrift.exec.absolute.path>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.iotdb</groupId>
+            <artifactId>iotdb-thrift-commons</artifactId>
+            <version>1.3.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <!-- Build and do session integration test -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-thrift</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.iotdb.tools</groupId>
+                                    <artifactId>iotdb-tools-thrift</artifactId>
+                                    
<version>${iotdb-tools-thrift.version}</version>
+                                    <classifier>${os.classifier}</classifier>
+                                    <type>zip</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}/thrift</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.maven-download-plugin</groupId>
+                <artifactId>download-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-catch2</id>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <url>${catch2.url}</url>
+                            <unpack>false</unpack>
+                            
<outputDirectory>${project.build.directory}/build/test/catch2</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <executions>
+                    <!-- TODO: Do this differently using the artifact 
downloader -->
+                    <execution>
+                        <id>copy-protocol-thrift-source</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/client.thrift</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-commons/src/main/thrift/common.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/common.thrift</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                    <!-- TODO: Do this differently using the 
maven-resources-plugin -->
+                    <execution>
+                        <!-- Copy source file and CmakeLists.txt into target 
directory -->
+                        <id>copy-cmakelist-file</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/CMakeLists.txt</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/CMakeLists.txt</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.h</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.h</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.cpp</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.cpp</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.thrift.tools</groupId>
+                <artifactId>maven-thrift-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-thrift-sources-cpp</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <!-- Move from generate-sources to generate-resources 
to avoid double executions -->
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <generator>cpp:no_skeleton</generator>
+                            
<thriftExecutable>${thrift.exec.absolute.path}</thriftExecutable>
+                            
<thriftSourceRoot>${project.build.directory}/protocols</thriftSourceRoot>
+                            
<outputDirectory>${project.build.directory}/build/main/generated-sources-cpp</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.cmake-maven-project</groupId>
+                <artifactId>cmake-maven-plugin</artifactId>
+                <executions>
+                    <!-- Uses a CMake generator to generate the build using 
the build tool of choice -->
+                    <execution>
+                        <id>cmake-generate</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <generator>${cmake.generator}</generator>
+                            
<sourcePath>${project.build.directory}/build/main</sourcePath>
+                            
<targetPath>${project.build.directory}/build/main</targetPath>
+                            <options>
+                                
<option>-DBOOST_INCLUDEDIR=${boost.include.dir}</option>
+                            </options>
+                        </configuration>
+                    </execution>
+                    <!-- Generate Cmake build directory to compile testing 
program -->
+                    <!-- Actually executes the build -->
+                    <execution>
+                        <id>cmake-compile</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <config>${cmake.build.type}</config>
+                            <!-- The directory where the "generate" step 
generated the build configuration -->
+                            
<projectDirectory>${project.build.directory}/build/main</projectDirectory>
+                        </configuration>
+                    </execution>
+                    <!-- Actually executes the testing compilation -->
+                </executions>
+            </plugin>
+            <!--Package all C++ header files and client library-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>package-client-cpp</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            
<finalName>${project.artifactId}-${project.version}</finalName>
+                            <descriptors>
+                                
<descriptor>src/assembly/client-cpp.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>.os-unix</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-unix-arm</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac-arm</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-windows</id>
+            <activation>
+                <os>
+                    <family>windows</family>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.bat</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.bat</iotdb.stop.script>
+                <os.suffix>win</os.suffix>
+            </properties>
+        </profile>
+    </profiles>
+</project>
+```
+- Execute  `mvn clean package -P with-cpp -pl iotdb-client/client-cpp -am 
-DskipTests`,successfully build.
+
 
-As soon as the compilation finishes successfully, the packaged zip file 
containing the library will be placed under 
`iotdb-client/client-cpp/target/client-cpp-{iotdb-version}-cpp-${os}-${aarch}.zip`
 and the example demonstrating the use of the library will be located at: 
`example/client-cpp-example/target/SessionExample` and 
`example/client-cpp-example/target/AllignedTimeseriesSessionExample`. 
 
 ## Native APIs
 
-Here we demonstrate the most commonly used interfaces and their parameters in 
the Native API:
+Here we show the commonly used interfaces and their parameters in the Native 
API:
 
 ### Initialization
 
-- Open a Session:
-    ```cpp
-    void open(); 
-    ```
+- Open a Session
+```cpp
+void open(); 
+```
 
-- Open a session, with a parameter controlling if RPC compression should be 
used:
-    ```cpp
-    void open(bool enableRPCCompression); 
-    ```
-    Notice: The RPC compression setting of the client is required to match 
that of the IoTDB server
+- Open a session, with a parameter to specify whether to enable RPC compression
+```cpp
+void open(bool enableRPCCompression); 
+```
+Notice: this RPC compression status of client must comply with that of IoTDB 
server
 
-- Close a session:
-    ```cpp
-    void close(); 
-    ```
+- Close a Session
+```cpp
+void close(); 
+```
 
 ### Data Definition Interface (DDL)
 
 #### Database Management
 
-- Create database:
+- CREATE DATABASE
 ```cpp
 void setStorageGroup(const std::string &storageGroupId);
 ```
 
-- Delete one or several databases:
+- Delete one or several databases
 ```cpp
 void deleteStorageGroup(const std::string &storageGroup);
 void deleteStorageGroups(const std::vector<std::string> &storageGroups);
@@ -183,7 +490,7 @@ void deleteStorageGroups(const std::vector<std::string> 
&storageGroups);
 
 #### Timeseries Management
 
-- Create one or multiple timeseries:
+- Create one or multiple timeseries
 ```cpp
 void createTimeseries(const std::string &path, TSDataType::TSDataType 
dataType, TSEncoding::TSEncoding encoding,
                           CompressionType::CompressionType compressor);
@@ -198,7 +505,7 @@ void createMultiTimeseries(const std::vector<std::string> 
&paths,
                            std::vector<std::string> *measurementAliasList);
 ```
 
-- Create aligned timeseries:
+- Create aligned timeseries
 ```cpp
 void createAlignedTimeseries(const std::string &deviceId,
                              const std::vector<std::string> &measurements,
@@ -207,35 +514,35 @@ void createAlignedTimeseries(const std::string &deviceId,
                              const 
std::vector<CompressionType::CompressionType> &compressors);
 ```
 
-- Delete one or several timeseries:
+- Delete one or several timeseries
 ```cpp
 void deleteTimeseries(const std::string &path);
 void deleteTimeseries(const std::vector<std::string> &paths);
 ```
 
-- Check whether a specific timeseries exists:
+- Check whether the specific timeseries exists.
 ```cpp
 bool checkTimeseriesExists(const std::string &path);
 ```
 
 #### Schema Template
 
-- Create a schema template:
+- Create a schema template
 ```cpp
 void createSchemaTemplate(const Template &templ);
 ```
 
-- Set the schema template named `templateName` at path `prefixPath`:
+- Set the schema template named `templateName` at path `prefixPath`.
 ```cpp
 void setSchemaTemplate(const std::string &template_name, const std::string 
&prefix_path);
 ```
 
-- Unset the schema template:
+- Unset the schema template
 ```cpp
 void unsetSchemaTemplate(const std::string &prefix_path, const std::string 
&template_name);
 ```
 
-- After a schema template was created, you can edit the template with 
following functions:
+- After measurement template created, you can edit the template with belowed 
APIs.
 ```cpp
 // Add aligned measurements to a template
 void addAlignedMeasurementsInTemplate(const std::string &template_name,
@@ -269,7 +576,7 @@ void addUnalignedMeasurementsInTemplate(const std::string 
&template_name,
 void deleteNodeInTemplate(const std::string &template_name, const std::string 
&path);
 ```
 
-- You can query schema templates with these APIs:
+- You can query measurement templates with these APIS:
 ```cpp
 // Return the amount of measurements inside a template
 int countMeasurementsInTemplate(const std::string &template_name);
@@ -286,124 +593,84 @@ std::vector<std::string> 
showMeasurementsInTemplate(const std::string &template_
 // Return all measurements paths under the designated patter inside template
 std::vector<std::string> showMeasurementsInTemplate(const std::string 
&template_name, const std::string &pattern);
 ```
-### Data Manipulation Interface (DMI)
+
+
+### Data Manipulation Interface (DML)
 
 #### Insert
 
-- Insert one record, which contains multiple measurement value of a given 
device and timestamp:
+> It is recommended to use insertTablet to help improve write efficiency.
+
+- Insert a Tablet,which is multiple rows of a device, each row has the same 
measurements
+    - Better Write Performance
+    - Support null values: fill the null value with any value, and then mark 
the null value via BitMap
+```cpp
+void insertTablet(Tablet &tablet);
+```
+
+- Insert multiple Tablets
+```cpp
+void insertTablets(std::unordered_map<std::string, Tablet *> &tablets);
+```
+
+- Insert a Record, which contains multiple measurement value of a device at a 
timestamp
 ```cpp
-void insertRecord(const std::string &deviceId, 
-                  int64_t time, 
-                  const std::vector<std::string> &measurements,
-                  const std::vector<char *> &values);
+void insertRecord(const std::string &deviceId, int64_t time, const 
std::vector<std::string> &measurements,
+                  const std::vector<TSDataType::TSDataType> &types, const 
std::vector<char *> &values);
 ```
 
-- Insert multiple Records for multiple devices (With type info in the 
`typesList` parameter the server doesn't need to do type inference, which 
results in better performance):
+- Insert multiple Records
 ```cpp
 void insertRecords(const std::vector<std::string> &deviceIds,
                    const std::vector<int64_t> &times,
                    const std::vector<std::vector<std::string>> 
&measurementsList,
+                   const std::vector<std::vector<TSDataType::TSDataType>> 
&typesList,
                    const std::vector<std::vector<char *>> &valuesList);
 ```
 
-- Insert multiple Records for the same device:
+- Insert multiple Records that belong to the same device. With type info the 
server has no need to do type inference, which leads a better performance
 ```cpp
 void insertRecordsOfOneDevice(const std::string &deviceId,
                               std::vector<int64_t> &times,
                               std::vector<std::vector<std::string>> 
&measurementsList,
+                              std::vector<std::vector<TSDataType::TSDataType>> 
&typesList,
                               std::vector<std::vector<char *>> &valuesList);
 ```
 
-All of the above versions require the server to figure out the data-types of 
each value, which comes with quite a performance-cost, therefore all of the 
above are also available in a version without type-inference:
+#### Insert with type inference
+
+Without type information, server has to do type inference, which may cost some 
time.
 
 ```cpp
-void insertRecord(const std::string &deviceId, 
-                  int64_t time, 
-                  const std::vector<std::string> &measurements,
-                  const std::vector<TSDataType::TSDataType> &types,
+void insertRecord(const std::string &deviceId, int64_t time, const 
std::vector<std::string> &measurements,
                   const std::vector<std::string> &values);
 
 
 void insertRecords(const std::vector<std::string> &deviceIds,
                    const std::vector<int64_t> &times,
                    const std::vector<std::vector<std::string>> 
&measurementsList,
-                   const std::vector<std::vector<TSDataType::TSDataType>> 
&typesList,
                    const std::vector<std::vector<std::string>> &valuesList);
 
 
 void insertRecordsOfOneDevice(const std::string &deviceId,
                               std::vector<int64_t> &times,
                               std::vector<std::vector<std::string>> 
&measurementsList,
-                              std::vector<std::vector<TSDataType::TSDataType>> 
&typesList,
                               const std::vector<std::vector<std::string>> 
&valuesList);
 ```
 
-For even better performance, it is recommended to use Tablets to help improve 
write efficiency.
-
-- Insert a Tablet,which inserts multiple rows of data for a given device. Each 
row has the same structure:
-    - Better write performance
-    - Support null values: Fill the null value with any value, and then mark 
the null value via BitMap
-```cpp
-void insertTablet(Tablet &tablet);
-```
-
-- Insert multiple Tablets
-```cpp
-void insertTablets(std::unordered_map<std::string, Tablet *> &tablets);
-```
-
 #### Insert data into Aligned Timeseries
 
-The insertion of aligned timeseries is performed by functions such as 
`insertAlignedXXX` however semantically they align to the non-aligned versions 
of the previous chapter:
-
-```cpp
-    void insertAlignedRecord(const std::string &deviceId,
-                             int64_t time, 
-                             const std::vector<std::string> &measurements,
-                             const std::vector<std::string> &values);
+The Insert of aligned timeseries uses interfaces like `insertAlignedXXX`, and 
others are similar to the above interfaces:
 
-    void insertAlignedRecord(const std::string &deviceId, 
-                             int64_t time, 
-                             const std::vector<std::string> &measurements,
-                             const std::vector<TSDataType::TSDataType> &types,
-                             const std::vector<char *> &values);
-
-    void insertAlignedRecords(const std::vector<std::string> &deviceIds,
-                              const std::vector<int64_t> &times,
-                              const std::vector<std::vector<std::string>> 
&measurementsList,
-                              const std::vector<std::vector<std::string>> 
&valuesList);
-
-    void insertAlignedRecords(const std::vector<std::string> &deviceIds,
-                              const std::vector<int64_t> &times,
-                              const std::vector<std::vector<std::string>> 
&measurementsList,
-                              const 
std::vector<std::vector<TSDataType::TSDataType>> &typesList,
-                              const std::vector<std::vector<char *>> 
&valuesList);
-
-    void insertAlignedRecordsOfOneDevice(const std::string &deviceId,
-                                         std::vector<int64_t> &times,
-                                         std::vector<std::vector<std::string>> 
&measurementsList,
-                                         
std::vector<std::vector<TSDataType::TSDataType>> &typesList,
-                                         std::vector<std::vector<char *>> 
&valuesList);
-
-    void insertAlignedRecordsOfOneDevice(const std::string &deviceId,
-                                         std::vector<int64_t> &times,
-                                         std::vector<std::vector<std::string>> 
&measurementsList,
-                                         
std::vector<std::vector<TSDataType::TSDataType>> &typesList,
-                                         std::vector<std::vector<char *>> 
&valuesList,
-                                         bool sorted);
-
-    void insertAlignedTablet(Tablet &tablet);
-
-    void insertAlignedTablet(Tablet &tablet, 
-                             bool sorted);
-
-    void insertAlignedTablets(std::unordered_map<std::string, Tablet *> 
&tablets, 
-                              bool sorted = false);
-```
+- insertAlignedRecord
+- insertAlignedRecords
+- insertAlignedRecordsOfOneDevice
+- insertAlignedTablet
+- insertAlignedTablets
 
 #### Delete
 
-- Delete data with timestamps before or equal to a given timestamp of one or 
several timeseries:
+- Delete data before or equal to a timestamp of one or several timeseries
 ```cpp
 void deleteData(const std::string &path, int64_t time);
 void deleteData(const std::vector<std::string> &deviceId, int64_t time);
@@ -412,28 +679,24 @@ void deleteData(const std::vector<std::string> &deviceId, 
int64_t time);
 ### IoTDB-SQL Interface
 
 - Execute query statement
-
-Query statements return data.
-
 ```cpp
-unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
+void executeNonQueryStatement(const std::string &sql);
 ```
 
-Non-Query statements don't return data (Delete, Create, ... statements)
-
 - Execute non query statement
 ```cpp
 void executeNonQueryStatement(const std::string &sql);
 ```
 
+
 ## Examples
 
-The sample code for using these interfaces is located in:
+The sample code of using these interfaces is in:
 
 - `example/client-cpp-example/src/SessionExample.cpp`
-- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp`
+- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` 
(使用对齐时间序列)
 
-As soon as the compilation finishes, the example project will be located at 
`example/client-cpp-example/target`
+If the compilation finishes successfully, the example project will be placed 
under `example/client-cpp-example/target`
 
 ## FAQ
 
@@ -443,6 +706,7 @@ If errors occur when compiling thrift source code, try to 
downgrade your xcode-c
 
 see 
https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file/65518087#65518087
 
+
 ### on Windows
 
 When Building Thrift and downloading packages via "wget", a possible annoying 
issue may occur with
@@ -451,6 +715,6 @@ error message looks like:
 Failed to delete cached file 
C:\Users\Administrator\.m2\repository\.cache\download-maven-plugin\index.ser
 ```
 Possible fixes:
-- Try to delete the ".m2\repository\.cache\" directory and try again.
+- Try to delete the ".m2\repository\\.cache\" directory and try again.
 - Add "\<skipCache>true\</skipCache>" configuration to the 
download-maven-plugin maven phase that complains this error.
 
diff --git a/src/UserGuide/latest/API/Programming-Cpp-Native-API.md 
b/src/UserGuide/latest/API/Programming-Cpp-Native-API.md
index e43a45f..41b9f8c 100644
--- a/src/UserGuide/latest/API/Programming-Cpp-Native-API.md
+++ b/src/UserGuide/latest/API/Programming-Cpp-Native-API.md
@@ -139,6 +139,317 @@ Under the root path of iotdb:
 
 If the compilation finishes successfully, the packaged zip file will be placed 
under `client-cpp/target/client-cpp-1.3.0-SNAPSHOT-cpp-${os}.zip`
 
+### Compile Q&A
+
+Q:How to deal with compile error`undefined reference to '_libc_sinle_thread'`?
+
+A:
+- Delete the test-related compilation and running operations in the pom.xml of 
C++client. The modified pom is as follows:
+
+```
+      
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.iotdb</groupId>
+        <artifactId>iotdb-client</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>client-cpp</artifactId>
+    <packaging>pom</packaging>
+    <name>IoTDB: Client: Client for CPP</name>
+    <description>C++ client</description>
+    <!-- TODO: The tests don't run, if distribution has not been built locally 
and fails without reasoning -->
+    <properties>
+        <catch2.url>https://alioss.timecho.com/upload/catch.hpp</catch2.url>
+        <cmake.build.type>Release</cmake.build.type>
+        <!-- Default value of cmake root -->
+        
<cmake.root.dir>${project.build.directory}/dependency/cmake/</cmake.root.dir>
+        
<thrift.exec.absolute.path>${project.build.directory}/thrift/bin/${thrift.executable}</thrift.exec.absolute.path>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.iotdb</groupId>
+            <artifactId>iotdb-thrift-commons</artifactId>
+            <version>1.3.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <!-- Build and do session integration test -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-thrift</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.iotdb.tools</groupId>
+                                    <artifactId>iotdb-tools-thrift</artifactId>
+                                    
<version>${iotdb-tools-thrift.version}</version>
+                                    <classifier>${os.classifier}</classifier>
+                                    <type>zip</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}/thrift</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.maven-download-plugin</groupId>
+                <artifactId>download-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-catch2</id>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <url>${catch2.url}</url>
+                            <unpack>false</unpack>
+                            
<outputDirectory>${project.build.directory}/build/test/catch2</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <executions>
+                    <!-- TODO: Do this differently using the artifact 
downloader -->
+                    <execution>
+                        <id>copy-protocol-thrift-source</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/client.thrift</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-commons/src/main/thrift/common.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/common.thrift</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                    <!-- TODO: Do this differently using the 
maven-resources-plugin -->
+                    <execution>
+                        <!-- Copy source file and CmakeLists.txt into target 
directory -->
+                        <id>copy-cmakelist-file</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/CMakeLists.txt</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/CMakeLists.txt</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.h</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.h</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.cpp</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.cpp</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.thrift.tools</groupId>
+                <artifactId>maven-thrift-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-thrift-sources-cpp</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <!-- Move from generate-sources to generate-resources 
to avoid double executions -->
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <generator>cpp:no_skeleton</generator>
+                            
<thriftExecutable>${thrift.exec.absolute.path}</thriftExecutable>
+                            
<thriftSourceRoot>${project.build.directory}/protocols</thriftSourceRoot>
+                            
<outputDirectory>${project.build.directory}/build/main/generated-sources-cpp</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.cmake-maven-project</groupId>
+                <artifactId>cmake-maven-plugin</artifactId>
+                <executions>
+                    <!-- Uses a CMake generator to generate the build using 
the build tool of choice -->
+                    <execution>
+                        <id>cmake-generate</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <generator>${cmake.generator}</generator>
+                            
<sourcePath>${project.build.directory}/build/main</sourcePath>
+                            
<targetPath>${project.build.directory}/build/main</targetPath>
+                            <options>
+                                
<option>-DBOOST_INCLUDEDIR=${boost.include.dir}</option>
+                            </options>
+                        </configuration>
+                    </execution>
+                    <!-- Generate Cmake build directory to compile testing 
program -->
+                    <!-- Actually executes the build -->
+                    <execution>
+                        <id>cmake-compile</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <config>${cmake.build.type}</config>
+                            <!-- The directory where the "generate" step 
generated the build configuration -->
+                            
<projectDirectory>${project.build.directory}/build/main</projectDirectory>
+                        </configuration>
+                    </execution>
+                    <!-- Actually executes the testing compilation -->
+                </executions>
+            </plugin>
+            <!--Package all C++ header files and client library-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>package-client-cpp</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            
<finalName>${project.artifactId}-${project.version}</finalName>
+                            <descriptors>
+                                
<descriptor>src/assembly/client-cpp.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>.os-unix</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-unix-arm</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac-arm</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-windows</id>
+            <activation>
+                <os>
+                    <family>windows</family>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.bat</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.bat</iotdb.stop.script>
+                <os.suffix>win</os.suffix>
+            </properties>
+        </profile>
+    </profiles>
+</project>
+```
+- Execute  `mvn clean package -P with-cpp -pl iotdb-client/client-cpp -am 
-DskipTests`,successfully build.
+
+
 
 ## Native APIs
 
diff --git a/src/zh/UserGuide/Master/API/Programming-Cpp-Native-API.md 
b/src/zh/UserGuide/Master/API/Programming-Cpp-Native-API.md
index 7637434..681d00c 100644
--- a/src/zh/UserGuide/Master/API/Programming-Cpp-Native-API.md
+++ b/src/zh/UserGuide/Master/API/Programming-Cpp-Native-API.md
@@ -24,7 +24,7 @@
 ## 依赖
 
 - Java 8+
-- Maven 3.9+
+- Maven 3.5+
 - Flex
 - Bison 2.7+
 - Boost 1.56+
@@ -132,6 +132,316 @@ git checkout rel/0.13
 
 编译成功后,打包好的 zip 文件位于 `client-cpp/target/client-cpp-1.3.0-SNAPSHOT-cpp-${os}.zip`
 
+### 编译 Q&A
+
+Q:编译报错`undefined reference to '_libc_sinle_thread'`如何处理?
+
+A:
+- 删除 C++client 的 pom.xml 里关于test相关的编译和运行操作,修改后的 pom 如下所示:
+
+```
+      
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.iotdb</groupId>
+        <artifactId>iotdb-client</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>client-cpp</artifactId>
+    <packaging>pom</packaging>
+    <name>IoTDB: Client: Client for CPP</name>
+    <description>C++ client</description>
+    <!-- TODO: The tests don't run, if distribution has not been built locally 
and fails without reasoning -->
+    <properties>
+        <catch2.url>https://alioss.timecho.com/upload/catch.hpp</catch2.url>
+        <cmake.build.type>Release</cmake.build.type>
+        <!-- Default value of cmake root -->
+        
<cmake.root.dir>${project.build.directory}/dependency/cmake/</cmake.root.dir>
+        
<thrift.exec.absolute.path>${project.build.directory}/thrift/bin/${thrift.executable}</thrift.exec.absolute.path>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.iotdb</groupId>
+            <artifactId>iotdb-thrift-commons</artifactId>
+            <version>1.3.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <!-- Build and do session integration test -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-thrift</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.iotdb.tools</groupId>
+                                    <artifactId>iotdb-tools-thrift</artifactId>
+                                    
<version>${iotdb-tools-thrift.version}</version>
+                                    <classifier>${os.classifier}</classifier>
+                                    <type>zip</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}/thrift</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.maven-download-plugin</groupId>
+                <artifactId>download-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-catch2</id>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <url>${catch2.url}</url>
+                            <unpack>false</unpack>
+                            
<outputDirectory>${project.build.directory}/build/test/catch2</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <executions>
+                    <!-- TODO: Do this differently using the artifact 
downloader -->
+                    <execution>
+                        <id>copy-protocol-thrift-source</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/client.thrift</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-commons/src/main/thrift/common.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/common.thrift</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                    <!-- TODO: Do this differently using the 
maven-resources-plugin -->
+                    <execution>
+                        <!-- Copy source file and CmakeLists.txt into target 
directory -->
+                        <id>copy-cmakelist-file</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/CMakeLists.txt</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/CMakeLists.txt</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.h</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.h</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.cpp</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.cpp</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.thrift.tools</groupId>
+                <artifactId>maven-thrift-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-thrift-sources-cpp</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <!-- Move from generate-sources to generate-resources 
to avoid double executions -->
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <generator>cpp:no_skeleton</generator>
+                            
<thriftExecutable>${thrift.exec.absolute.path}</thriftExecutable>
+                            
<thriftSourceRoot>${project.build.directory}/protocols</thriftSourceRoot>
+                            
<outputDirectory>${project.build.directory}/build/main/generated-sources-cpp</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.cmake-maven-project</groupId>
+                <artifactId>cmake-maven-plugin</artifactId>
+                <executions>
+                    <!-- Uses a CMake generator to generate the build using 
the build tool of choice -->
+                    <execution>
+                        <id>cmake-generate</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <generator>${cmake.generator}</generator>
+                            
<sourcePath>${project.build.directory}/build/main</sourcePath>
+                            
<targetPath>${project.build.directory}/build/main</targetPath>
+                            <options>
+                                
<option>-DBOOST_INCLUDEDIR=${boost.include.dir}</option>
+                            </options>
+                        </configuration>
+                    </execution>
+                    <!-- Generate Cmake build directory to compile testing 
program -->
+                    <!-- Actually executes the build -->
+                    <execution>
+                        <id>cmake-compile</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <config>${cmake.build.type}</config>
+                            <!-- The directory where the "generate" step 
generated the build configuration -->
+                            
<projectDirectory>${project.build.directory}/build/main</projectDirectory>
+                        </configuration>
+                    </execution>
+                    <!-- Actually executes the testing compilation -->
+                </executions>
+            </plugin>
+            <!--Package all C++ header files and client library-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>package-client-cpp</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            
<finalName>${project.artifactId}-${project.version}</finalName>
+                            <descriptors>
+                                
<descriptor>src/assembly/client-cpp.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>.os-unix</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-unix-arm</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac-arm</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-windows</id>
+            <activation>
+                <os>
+                    <family>windows</family>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.bat</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.bat</iotdb.stop.script>
+                <os.suffix>win</os.suffix>
+            </properties>
+        </profile>
+    </profiles>
+</project>
+```
+- 再次执行 mvn clean package -P with-cpp -pl iotdb-client/client-cpp -am 
-DskipTests,成功build
+
 
 ## 基本接口说明
 
@@ -364,7 +674,7 @@ void deleteData(const std::vector<std::string> &deviceId, 
int64_t time);
 
 - 执行查询语句
 ```cpp
-unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
+void executeNonQueryStatement(const std::string &sql);
 ```
 
 - 执行非查询语句
diff --git a/src/zh/UserGuide/latest/API/Programming-Cpp-Native-API.md 
b/src/zh/UserGuide/latest/API/Programming-Cpp-Native-API.md
index 5a24e46..681d00c 100644
--- a/src/zh/UserGuide/latest/API/Programming-Cpp-Native-API.md
+++ b/src/zh/UserGuide/latest/API/Programming-Cpp-Native-API.md
@@ -132,6 +132,316 @@ git checkout rel/0.13
 
 编译成功后,打包好的 zip 文件位于 `client-cpp/target/client-cpp-1.3.0-SNAPSHOT-cpp-${os}.zip`
 
+### 编译 Q&A
+
+Q:编译报错`undefined reference to '_libc_sinle_thread'`如何处理?
+
+A:
+- 删除 C++client 的 pom.xml 里关于test相关的编译和运行操作,修改后的 pom 如下所示:
+
+```
+      
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.iotdb</groupId>
+        <artifactId>iotdb-client</artifactId>
+        <version>1.3.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>client-cpp</artifactId>
+    <packaging>pom</packaging>
+    <name>IoTDB: Client: Client for CPP</name>
+    <description>C++ client</description>
+    <!-- TODO: The tests don't run, if distribution has not been built locally 
and fails without reasoning -->
+    <properties>
+        <catch2.url>https://alioss.timecho.com/upload/catch.hpp</catch2.url>
+        <cmake.build.type>Release</cmake.build.type>
+        <!-- Default value of cmake root -->
+        
<cmake.root.dir>${project.build.directory}/dependency/cmake/</cmake.root.dir>
+        
<thrift.exec.absolute.path>${project.build.directory}/thrift/bin/${thrift.executable}</thrift.exec.absolute.path>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.iotdb</groupId>
+            <artifactId>iotdb-thrift-commons</artifactId>
+            <version>1.3.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <!-- Build and do session integration test -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-thrift</id>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.iotdb.tools</groupId>
+                                    <artifactId>iotdb-tools-thrift</artifactId>
+                                    
<version>${iotdb-tools-thrift.version}</version>
+                                    <classifier>${os.classifier}</classifier>
+                                    <type>zip</type>
+                                    <overWrite>true</overWrite>
+                                    
<outputDirectory>${project.build.directory}/thrift</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.maven-download-plugin</groupId>
+                <artifactId>download-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-catch2</id>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <url>${catch2.url}</url>
+                            <unpack>false</unpack>
+                            
<outputDirectory>${project.build.directory}/build/test/catch2</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.coderplus.maven.plugins</groupId>
+                <artifactId>copy-rename-maven-plugin</artifactId>
+                <executions>
+                    <!-- TODO: Do this differently using the artifact 
downloader -->
+                    <execution>
+                        <id>copy-protocol-thrift-source</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-datanode/src/main/thrift/client.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/client.thrift</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>../../iotdb-protocol/thrift-commons/src/main/thrift/common.thrift</sourceFile>
+                                    
<destinationFile>${project.build.directory}/protocols/common.thrift</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                    <!-- TODO: Do this differently using the 
maven-resources-plugin -->
+                    <execution>
+                        <!-- Copy source file and CmakeLists.txt into target 
directory -->
+                        <id>copy-cmakelist-file</id>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <fileSets>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/CMakeLists.txt</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/CMakeLists.txt</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.h</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.h</destinationFile>
+                                </fileSet>
+                                <fileSet>
+                                    
<sourceFile>${project.basedir}/src/main/Session.cpp</sourceFile>
+                                    
<destinationFile>${project.build.directory}/build/main/generated-sources-cpp/Session.cpp</destinationFile>
+                                </fileSet>
+                            </fileSets>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.thrift.tools</groupId>
+                <artifactId>maven-thrift-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate-thrift-sources-cpp</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <!-- Move from generate-sources to generate-resources 
to avoid double executions -->
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <generator>cpp:no_skeleton</generator>
+                            
<thriftExecutable>${thrift.exec.absolute.path}</thriftExecutable>
+                            
<thriftSourceRoot>${project.build.directory}/protocols</thriftSourceRoot>
+                            
<outputDirectory>${project.build.directory}/build/main/generated-sources-cpp</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.googlecode.cmake-maven-project</groupId>
+                <artifactId>cmake-maven-plugin</artifactId>
+                <executions>
+                    <!-- Uses a CMake generator to generate the build using 
the build tool of choice -->
+                    <execution>
+                        <id>cmake-generate</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <generator>${cmake.generator}</generator>
+                            
<sourcePath>${project.build.directory}/build/main</sourcePath>
+                            
<targetPath>${project.build.directory}/build/main</targetPath>
+                            <options>
+                                
<option>-DBOOST_INCLUDEDIR=${boost.include.dir}</option>
+                            </options>
+                        </configuration>
+                    </execution>
+                    <!-- Generate Cmake build directory to compile testing 
program -->
+                    <!-- Actually executes the build -->
+                    <execution>
+                        <id>cmake-compile</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <phase>compile</phase>
+                        <configuration>
+                            <config>${cmake.build.type}</config>
+                            <!-- The directory where the "generate" step 
generated the build configuration -->
+                            
<projectDirectory>${project.build.directory}/build/main</projectDirectory>
+                        </configuration>
+                    </execution>
+                    <!-- Actually executes the testing compilation -->
+                </executions>
+            </plugin>
+            <!--Package all C++ header files and client library-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>package-client-cpp</id>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            
<finalName>${project.artifactId}-${project.version}</finalName>
+                            <descriptors>
+                                
<descriptor>src/assembly/client-cpp.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id>.os-unix</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-unix-arm</id>
+            <activation>
+                <os>
+                    <name>Linux</name>
+                    <family>unix</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>linux</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>!aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-mac-arm</id>
+            <activation>
+                <os>
+                    <family>mac</family>
+                    <arch>aarch64</arch>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.sh</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.sh</iotdb.stop.script>
+                <os.suffix>mac</os.suffix>
+            </properties>
+        </profile>
+        <profile>
+            <id>.os-windows</id>
+            <activation>
+                <os>
+                    <family>windows</family>
+                </os>
+            </activation>
+            <properties>
+                <iotdb.start.script>start-standalone.bat</iotdb.start.script>
+                <iotdb.stop.script>stop-standalone.bat</iotdb.stop.script>
+                <os.suffix>win</os.suffix>
+            </properties>
+        </profile>
+    </profiles>
+</project>
+```
+- 再次执行 mvn clean package -P with-cpp -pl iotdb-client/client-cpp -am 
-DskipTests,成功build
+
 
 ## 基本接口说明
 

Reply via email to