Last active
August 29, 2015 14:19
-
-
Save snoopspy/642195da3f91cca811bc to your computer and use it in GitHub Desktop.
global_object_glog_test
This file contains 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 <glog/logging.h> | |
class Obj { | |
public: | |
Obj() { DLOG(INFO) << "Obj::Obj()"; } | |
virtual ~Obj() { DLOG(INFO) << "Obj::~Obj()"; } | |
void foo() { DLOG(INFO) << "Obj::foo()"; } | |
} obj; // global instance(constructor is called before main entry) | |
int main() { | |
DLOG(INFO) << "beg main"; | |
obj.foo(); | |
DLOG(INFO) << "end main"; | |
} |
This file contains 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: | |
g++ -o main.o -c main.cpp | |
g++ -o global_object_glog_test main.o -lglog -pthread | |
clean: | |
rm -rf global_object_glog_test | |
rm -rf *.o |
This file contains 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
# ./global_object_glog_test | |
Segmentation fault (core dumped) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment