summaryrefslogtreecommitdiff
path: root/xmake/templates/c++/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/templates/c++/static/src')
-rw-r--r--xmake/templates/c++/static/src/foo.cpp5
-rw-r--r--xmake/templates/c++/static/src/foo.h9
-rw-r--r--xmake/templates/c++/static/src/main.cpp7
3 files changed, 21 insertions, 0 deletions
diff --git a/xmake/templates/c++/static/src/foo.cpp b/xmake/templates/c++/static/src/foo.cpp
new file mode 100644
index 000000000..1a1fb3425
--- /dev/null
+++ b/xmake/templates/c++/static/src/foo.cpp
@@ -0,0 +1,5 @@
+#include "foo.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/xmake/templates/c++/static/src/foo.h b/xmake/templates/c++/static/src/foo.h
new file mode 100644
index 000000000..d2506bca9
--- /dev/null
+++ b/xmake/templates/c++/static/src/foo.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/xmake/templates/c++/static/src/main.cpp b/xmake/templates/c++/static/src/main.cpp
new file mode 100644
index 000000000..3834ee4d3
--- /dev/null
+++ b/xmake/templates/c++/static/src/main.cpp
@@ -0,0 +1,7 @@
+#include "foo.h"
+#include <iostream>
+
+int main(int argc, char **argv) {
+ std::cout << "add(1, 2) = " << add(1, 2) << std::endl;
+ return 0;
+}