简体   繁体   English

mex编译给出“……没有依赖模板参数的参数”错误

[英]mex compilation gives “there are no arguments to … that depend on a template parameter” error

I am trying to compile a mex library using MATLAB under Ubuntu. 我正在尝试在Ubuntu下使用MATLAB编译mex库 I fet the following error even I try to compile with -fpermissive (ie mex -v CXXFLAGS='$CFLAGS -fpermissive' Coarse2FineTwoFrames.cpp GaussianPyramid.cpp OpticalFlow.cpp , what must I do? Is there a problem in the library code? 即使尝试使用-fpermissive(即mex -v CXXFLAGS='$CFLAGS -fpermissive' Coarse2FineTwoFrames.cpp GaussianPyramid.cpp OpticalFlow.cpp ,我也mex -v CXXFLAGS='$CFLAGS -fpermissive' Coarse2FineTwoFrames.cpp GaussianPyramid.cpp OpticalFlow.cpp以下错误),我该怎么办?库代码是否有问题?

    In file included from Image.h:11:0,
                     from Coarse2FineTwoFrames.cpp:3:
    Stochastic.h:11:13: warning: extra tokens at end of #ifndef directive [enabled by default]
    In file included from OpticalFlow.h:4:0,
                     from Coarse2FineTwoFrames.cpp:4:
    NoiseModel.h:6:0: warning: "PI" redefined [enabled by default]
    Stochastic.h:16:0: note: this is the location of the previous definition
    In file included from Image.h:6:0,
                     from Coarse2FineTwoFrames.cpp:3:
    ImageProcessing.h: In static member function ‘static void ImageProcessing::BilinearInterpolate(const T1*, int, int, int, double, double, T2*)’:
    ImageProcessing.h:133:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    ImageProcessing.h:134:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    ImageProcessing.h: In static member function ‘static T1 ImageProcessing::BilinearInterpolate(const T1*, int, int, double, double)’:
    ImageProcessing.h:155:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    ImageProcessing.h:156:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    ImageProcessing.h: In static member function ‘static void ImageProcessing::BilinearInterpolate_transpose(const T1*, int, int, int, double, double, T2*)’:
    ImageProcessing.h:182:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    ImageProcessing.h:183:23: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    In file included from Image.h:11:0,
                     from Coarse2FineTwoFrames.cpp:3:
    Stochastic.h: In static member function ‘static void CStochastic::GaussianFiltering(T1*, T2*, int, int, int, double)’:
    Stochastic.h:402:32: warning: there are no arguments to ‘__min’ that depend on a template parameter, so a declaration of ‘__min’ must be available [-fpermissive]
    In file included from Coarse2FineTwoFrames.cpp:3:0:
    Image.h: In member function ‘virtual bool Image<T>::loadImage(std::ifstream&)’:
    Image.h:846:26: warning: there are no arguments to ‘strcmpi’ that depend on a template parameter, so a declaration of ‘strcmpi’ must be available [-fpermissive]
    Image.h:848:26: warning: there are no arguments to ‘strcmpi’ that depend on a template parameter, so a declaration of ‘strcmpi’ must be available [-fpermissive]
    Image.h:850:34: warning: there are no arguments to ‘strcmpi’ that depend on a template parameter, so a declaration of ‘strcmpi’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::imfilter_hv(Image<T1>&, const Image<double>&, const Image<double>&) const’:
    Image.h:1328:54: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:1329:54: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::imfilter_hv_transpose(Image<T1>&, const Image<double>&, const Image<double>&) const’:
    Image.h:1417:54: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:1418:54: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::warpImageBicubic(Image<T>&, const Image<T1>&, const Image<T1>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const’:
    Image.h:2277:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2278:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2279:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2280:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::warpImageBicubic(Image<T>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const’:
    Image.h:2339:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2340:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2341:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2342:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::warpImageBicubicCoeff(Image<T1>&) const’:
    Image.h:2439:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2440:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2441:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2442:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T1>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const’:
    Image.h:2536:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2537:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2538:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2539:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘void Image<T>::warpImageBicubicRef(const Image<T>&, Image<T>&, const Image<T1>&, const Image<T2>&, const Image<T2>&) const’:
    Image.h:2606:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2607:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2608:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h:2609:25: warning: there are no arguments to ‘__max’ that depend on a template parameter, so a declaration of ‘__max’ must be available [-fpermissive]
    Image.h: In member function ‘bool Image<T>::loadImage(std::ifstream&) [with T = double, std::ifstream = std::basic_ifstream<char>]’:
    Coarse2FineTwoFrames.cpp:102:1:   instantiated from here
    Image.h:846:2: error: ‘strcmpi’ was not declared in this scope
    Image.h:848:2: error: ‘strcmpi’ was not declared in this scope
    Image.h:850:2: error: ‘strcmpi’ was not declared in this scope
    In file included from Image.h:6:0,
                     from Coarse2FineTwoFrames.cpp:3:
    ImageProcessing.h: In static member function ‘static void ImageProcessing::BilinearInterpolate(const T1*, int, int, int, double, double, T2*) [with T1 = double, T2 = double]’:
    ImageProcessing.h:218:4:   instantiated from ‘static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int, double) [with T1 = double, T2 = double]’
    Image.h:719:2:   instantiated from ‘bool Image<T>::imresize(double) [with T = double]’
    Coarse2FineTwoFrames.cpp:102:1:   instantiated from here
    ImageProcessing.h:133:2: error: ‘__min’ was not declared in this scope
    ImageProcessing.h:133:2: error: ‘__max’ was not declared in this scope
    In file included from Image.h:6:0,
                     from Coarse2FineTwoFrames.cpp:3:
    ImageProcessing.h: In static member function ‘static T ImageProcessing::EnforceRange(const T&, const int&) [with T = int]’:
    ImageProcessing.h:139:4:   instantiated from ‘static void ImageProcessing::BilinearInterpolate(const T1*, int, int, int, double, double, T2*) [with T1 = double, T2 = double]’
    ImageProcessing.h:218:4:   instantiated from ‘static void ImageProcessing::ResizeImage(const T1*, T2*, int, int, int, double) [with T1 = double, T2 = double]’
    Image.h:719:2:   instantiated from ‘bool Image<T>::imresize(double) [with T = double]’
    Coarse2FineTwoFrames.cpp:102:1:   instantiated from here
    ImageProcessing.h:23:98: error: ‘__max’ was not declared in this scope
    ImageProcessing.h:23:98: error: ‘__min’ was not declared in this scope

        mex: compile of ' "Coarse2FineTwoFrames.cpp"' failed.

It looks like you are trying to build OpticalFlow package for matlab. 看来您正在尝试为Matlab构建OpticalFlow软件包。 I got the same error and resolved it by setting the compilation flag _LINUX_MAC in project.h. 我遇到了相同的错误,并通过在project.h中设置编译标志_LINUX_MAC来解决了该错误。 Another compilation error was resolved by using instead of "math.h". 通过使用代替“ math.h”解决了另一个编译错误。

Cheers, 干杯,

Eitan 埃坦

According to your error message. 根据您的错误信息。 strcmpi is not defined. strcmpi

From a very quick google search, you can see that it is define in string.h . 通过非常快速的google搜索,您可以看到它是在string.h定义的。

So try to add #include <string.h> at the beginning of image.h . 因此,尝试在image.h的开头添加#include <string.h>

对于绝对错误,我在OpticalFlow.cpp中使用“ #include <cmath>”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有依赖于模板参数的参数 - There are no arguments that depend on a template parameter 错误:“static_assert”没有依赖于模板参数的参数 - Error: there are no arguments to 'static_assert' that depend on a template parameter 错误:“at”没有依赖于模板参数的参数,因此at的声明必须可用 - error: there are no arguments to 'at' that depend on a template parameter, so a declaration of at must be available 如何解决“没有依赖模板参数的&#39;glGenVertexArrays&#39;参数……”在C ++中的错误 - How to fix 'there are no arguments to 'glGenVertexArrays' that depend on a template parameter …' error in c++ C ++错误:“没有&#39;setw&#39;参数依赖模板参数 - C++ Error: "There are no arguments to 'setw' that depend on a template parameter MEX编译错误 - MEX compilation error g ++:错误:“ pow”没有依赖模板参数的参数,因此“ pow”的声明必须可用[-fpermissive] - g++: error: there are no arguments to 'pow' that depend on a template parameter, so a declaration of 'pow' must be available [-fpermissive] mex编译期间链接错误 - Linking error during mex compilation 在mex函数中使用OpenCV:编译后出错 - Use OpenCV in mex function : error after compilation 声明指向模板函数的指针数组会导致编译错误 - Declaring Array of pointer to template functions gives compilation error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM