小编use*_*323的帖子

使用ax_check_compile_flag的autotools语法错误

我正在使用autotools来构建我的C++应用程序.在我的configure.ac中,我有以下行:

AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])
Run Code Online (Sandbox Code Playgroud)

执行./configure(运行autoreconf -i之后)会导致以下错误:

./configure: line 3825: syntax error near unexpected token `-Wall,'
./configure: line 3825: `AX_CHECK_COMPILE_FLAG(-Wall, CPPFLAGS="$CPPFLAGS -Wall")'
Run Code Online (Sandbox Code Playgroud)

我的系统:Linux web 3.2.0-4-amd64#1 SMP Debian 3.2.65-1 + deb7u2 x86_64 GNU/Linux

在我的Ubuntu机器上运行良好,为什么我会收到此错误?

c++ linux autotools configure

9
推荐指数
1
解决办法
3451
查看次数

返回泛型方法中的特定类型

我写了以下方法:

public T CreatePackage<T>() where T : new()
{
        var package = new T();

        if (typeof(ComponentInformationPackage) == typeof(T))
        {
            var compInfoPackage = package as ComponentInformationPackage;

            // ...

            return compInfoPackage;
        }

        throw new System.NotImplementedException();
}
Run Code Online (Sandbox Code Playgroud)

我检查T是什么类型,根据这个我对待我的变量.当我想要返回它时,我得到编译器错误.

" ComponentInformationPackage类型不能隐式转换为T"

我怎么解决这个问题?

c# generics

4
推荐指数
2
解决办法
2435
查看次数

标签 统计

autotools ×1

c# ×1

c++ ×1

configure ×1

generics ×1

linux ×1