Created
August 26, 2016 14:03
-
-
Save androm3da/9126ff51b5b47f69b99b1e3db845d85b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <uuid/uuid.h> | |
extern "C" int foo(int x); | |
int main(int argc, char *argv[]) | |
{ | |
auto total = foo(argc) + foo(argc); | |
uuid_t u; | |
uuid_generate(u); | |
char uuid_text[37]; | |
uuid_unparse(u, uuid_text); | |
std::cout << "UUID: " << uuid_text << "\n"; | |
return total; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int foo(int x) | |
{ | |
return x+x; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: foo | |
CXXFLAGS+= -std=c++11 -Wall | |
LDLIBS+=-lstdc++ $(shell pkg-config --libs uuid) | |
foo: foo.o bar.o | |
.PHONY: clean all | |
clean: | |
$(RM) foo foo.o bar.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ make clean | |
rm -f foo foo.o bar.o | |
$ make CXX=clang++ && ./foo ; echo $? | |
cc -c -o foo.o foo.c | |
clang++ -std=c++11 -Wall -c -o bar.o bar.cpp | |
cc foo.o bar.o -lstdc++ -luuid -o foo | |
UUID: e55e3138-5634-4852-87fd-ab993d2a95d1 | |
4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment