title: Makefile - to create a static library
body: <p>I have two files: osm.h and osm.cpp</p>
  
  <p>I tried to create static lib from them, called "libosm.a" with Makefile.</p>
  
  <p>my cpp and h file work( I compiled them without Makefile), but my Makefile doesn't work. This is the Makefile:</p>
  
  <pre><code>CC = g++
  RANLIB = ranlib
  
  LIBSRC = osm.cpp
  LIBOBJ=$(LIBSRC:.cpp=.o)
  
  CFLAGS = -Wall -g -O0
  LOADLIBES = -L./
  
  OSMLIB = libosm.a
  TARGETS = $(OSMLIB)
  
  all: $(TARGETS)
  
  osm.o: osm.cpp osm.h
      $(CC) -c osm.cpp -o osm.o
  
  $(TARGETS): $(LIBOBJ)
      ar rcs $(OSMLIB) osm.o
      ranlib $(OSMLIB)
  
  clean:
      rm osm.o $(TARGETS) $(OSMLIB) $(LIBOBJ)
  
  depend:
      makedepend -- $(CFLAGS) -- $(SRC) $(LIBSRC)
  </code></pre>
  
  <p>and this is part of the error I'm getting:</p>
  
  <pre><code>osm.o: In function `_start':
  (.text+0x0): multiple definition of `_start'
  /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
  /usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
  </code></pre>
  
  <p>can anyone help?</p>