未定义对“ cv :: optflow :: createOptFlow_DualTVL1()”的引用

I have successfully installed gocv package from https://github.com/hybridgroup/gocv and I am trying to run C++ code which I wrapped in C library inside my Go project. But there seems to be the problem when I try to call cv::optflow::createOptFlow_DualTVL1() method. I get undefined reference error. I dont know why, since in optflow.hpp file there is a method called createOptFlow_DualTVL1()

Here is my main.go file:

package main

/*
#cgo LDFLAGS: -L/usr/local/lib -lopencv_core -lopencv_video -lopencv_videoio -lopencv_highgui -lopencv_tracking -lopencv_optflow
#include "dense_flow.h"
*/
import (
       "C"
       "gocv.io/x/gocv"
)

func main(){

}

NOTE: dense_flow.h is where I have declared my CalculateT4VL1() function which calls to createOptFlow_DualTVL1() inside dense_flow.cpp file.

Operating System and version: Ubuntu 18.04

OpenCV version used: 4.0.0

GoCV version used: 0.18

Go version: 1.12

This optical flow imported from contrib module. You need advanced import ( https://github.com/hybridgroup/gocv/tree/master/contrib ): "gocv.io/x/gocv/contrib"