split go and c examples
This commit is contained in:
13
test/c/BUILD
Normal file
13
test/c/BUILD
Normal file
@@ -0,0 +1,13 @@
|
||||
cc_binary(
|
||||
name = "hello",
|
||||
srcs = ["hello.cpp"],
|
||||
target_compatible_with = select({
|
||||
"@platforms//os:linux": ["@com_github_ziglang_zig//:musl"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "exception",
|
||||
srcs = ["exception.cpp"],
|
||||
)
|
||||
12
test/c/exception.cpp
Normal file
12
test/c/exception.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cerr << "will throw and expect to catch an error..." << std::endl;
|
||||
|
||||
try {
|
||||
throw "error";
|
||||
} catch (const char* msg) {
|
||||
std::cerr << "caught: " << msg << std::endl;
|
||||
}
|
||||
std::cerr << "done" << std::endl;
|
||||
}
|
||||
5
test/c/hello.cpp
Normal file
5
test/c/hello.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World!" << std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user