0

I'm working remotely on Linux operating system, where I'm trying to compile a .cu file. The folder contains a main.cu file which does an histogram equalization. It uses opencv libraries. How should I create the makefile? Everything I tried didn't work. I got this error: undefined reference to cv::imread(cv::String const&, int)' Is this the right way to make a makefile?

BINARY=cuda
SOURCES= main.cu
LIBPATHS = /usr/include/opencv2/libopencv_highgui.so
CC=nvcc


OBJECTS=$(SOURCES:.cu=.o)
INCFLAGS=$(foreach TMP,$(INCPATHS),-I$(TMP))
LIBFLAGS=$(foreach TMP,$(LIBPATHS),-L$(TMP))

OPENCV = `pkg-config opencv --cflags --libs`
LIBS = $(OPENCV)


$(PROG):$(SRCS)
    $(CC) $(CFLAGS) -o $(PROG) $(SRCS) $(LIBS)

all:
    $(CC) $(INCFLAGS) $(SOURCES) -o $(BINARY)

distclean:
    rm -f $(BINARY)

clean:
    rm -f $(BINARY)

I got these two include in my main.cu file:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

Thanks a lot

talonmies
  • 70,661
  • 34
  • 192
  • 269
this.jind
  • 319
  • 1
  • 4
  • 14
  • Does this answer your question? [Undefined reference to cv::imread(cv::String const&, int)](https://stackoverflow.com/questions/48687259/undefined-reference-to-cvimreadcvstring-const-int) – talonmies Jul 01 '20 at 16:55
  • `imread` belongs to `imgcodecs.hpp`. – Burak Jul 08 '20 at 16:20

0 Answers0