This is the first time I am writing a makefile. This doesn't work (for example, if I modify ClientSocket.cc it just says "uptodate". Also throws up lots of dependency errors if I run make myprog). Can you please tell what is wrong in this? Thank you
myprog: myprog.o Client.o ClientSocket.o Socket.o
g++ -Wall -g Socket.o ClientSocket.o Client.o myprog.o -o myprog
myprog.o: myprog.cc
g++ -Wall -g -c myprog.cc
Client.o: Client.cc Client.h
g++ -Wall -g -c Client.cc
ClientSocket.o: ClientSocket.cc ClientSocket.h
g++ -Wall -g -c ClientSocket.cc
Socket.o: Socket.cc Socket.h
g++ -Wall -g -c Socket.cc
Errors when running make myprog:
cc mprog.o -o myprog
myprog.o: In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
myprog.cc:(.text+0xe): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
There are many others. Like:
myprog.cc:(.text+0x1a4): undefined reference to `std::cout'
myprog.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status