Created
October 30, 2012 06:27
-
-
Save iwadon/3978621 to your computer and use it in GitHub Desktop.
gist:3978621 の問題を単純化してみた。まあ仕方ないのかなあ。
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> | |
| void set_value(int new_value); | |
| struct Foo | |
| { | |
| Foo() | |
| { | |
| set_value(1); | |
| } | |
| }; | |
| Foo foo; |
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> | |
| int value; | |
| void set_value(int new_value) | |
| { | |
| value = new_value; | |
| } | |
| int main() | |
| { | |
| std::cout << value << std::endl; | |
| return 0; | |
| } |
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
| CXX = g++ | |
| CXXFLAGS = -Wall -O0 -g | |
| CPPFLAGS = | |
| AR = ar | |
| LD = g++ | |
| LDFLAGS = | |
| LIBS = | |
| RM = rm -f | |
| all: ok ng | |
| clean: | |
| $(RM) ok ng | |
| $(RM) libfoo.a | |
| $(RM) main.o foo.o | |
| ok: main.o foo.o | |
| $(LD) $(LDFLAGS) -o $@ main.o foo.o | |
| ng: main.o libfoo.a | |
| $(LD) $(LDFLAGS) -o $@ main.o -L. -lfoo | |
| main.o: main.cc | |
| $(CXX) $(CXXFLAGS) -o $@ -c $< | |
| foo.o: foo.cc | |
| $(CXX) $(CXXFLAGS) -o $@ -c $< | |
| libfoo.a: foo.o | |
| $(RM) $@; $(AR) crs $@ foo.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment