gcrypt-example icon indicating copy to clipboard operation
gcrypt-example copied to clipboard

Makefile does not work on Ubuntu

Open syddel opened this issue 11 years ago • 1 comments

I'm using Ubuntu 15.04, and the Makefile doesn't work. Not sure if this is a Ubuntu bug or not, but Ubuntu needs the libraries included at the end of the line.

For example:

g++ -lgcrypt main.cc gcry.o -o main

is not the same as:

g++ main.cc gcry.o -lgcrypt

The first will fail, whereas the second will work.

On Ubuntu, this Makefile will work:

CXX = g++
LDFLAGS = -lgcrypt
CXXFLAGS = -std=c++11 -Wall -Wextra -g

BINS = keygen main
OBJS = gcry.o

all: $(BINS)

keygen: gcry.o
    $(CXX) $(CXXFLAGS) keygen.cc $(OBJS) -o keygen $(LDFLAGS)

main: gcry.o
    $(CXX) $(CXXFLAGS) main.cc $(OBJS) -o main $(LDFLAGS)

gcry.o: gcry.cc

clean:
    rm -f *.o $(BINS)

syddel avatar Jun 11 '15 17:06 syddel

Thanks for pointing this out. I've updated the repo with your makefile.

vedantk avatar Jun 23 '15 19:06 vedantk