标签: compiler-errors

C编译错误:"可能无法初始化可变大小的对象"

为什么我使用以下代码收到错误"可能无法初始化可变大小的对象"?

int boardAux[length][length] = {{0}};
Run Code Online (Sandbox Code Playgroud)

c compiler-errors initializer-list variable-length-array

83
推荐指数
5
解决办法
14万
查看次数

PyCharm可以列出项目中的所有Python错误吗?

我在虚拟环境中使用python 2.7和PyCharm 2.7(2013年2月7日的新版本).

每当我在其中打开一个具有明确错误的python文件(相当于其他语言中的编译错误,例如使用未声明的变量,调用不存在的函数)时,它会在文件的装订线中显示红色条纹.

因此,我偶然发现错误,因为我碰巧导航到包含它们的文件.我真正想要的是能够在单独的窗口中列出所有python错误.Visual Studio 2005/2008/2010/... IDE有一个单独的"错误"视图,其中列出了所有文件名和行号,并使我能够单击这些错误中的任何一个并直接导航到资源.

PyCharm有这样的东西吗?

python compiler-errors pycharm python-2.7

83
推荐指数
3
解决办法
2万
查看次数

为什么这个Java 8 lambda无法编译?

以下Java代码无法编译:

@FunctionalInterface
private interface BiConsumer<A, B> {
    void accept(A a, B b);
}

private static void takeBiConsumer(BiConsumer<String, String> bc) { }

public static void main(String[] args) {
    takeBiConsumer((String s1, String s2) -> new String("hi")); // OK
    takeBiConsumer((String s1, String s2) -> "hi"); // Error
}
Run Code Online (Sandbox Code Playgroud)

编译器报告:

Error:(31, 58) java: incompatible types: bad return type in lambda expression
    java.lang.String cannot be converted to void
Run Code Online (Sandbox Code Playgroud)

奇怪的是标记为"OK"的行编译得很好,但标记为"Error"的行失败了.他们看起来基本相同.

java lambda compiler-errors void java-8

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

C# - 无法将List <Product>类型隐式转换为List <IProduct>

我有一个包含所有接口定义
的项目:RivWorks.Interfaces 我有一个项目,我定义了具体的实现:RivWorks.DTO

我之前已经完成了数百次但由于某种原因我现在收到此错误:

无法将类型'System.Collections.Generic.List <RivWorks.DTO.Product>'隐式转换为'System.Collections.Generic.List <RivWorks.Interfaces.DataContracts.IProduct>'

接口定义(缩写):

namespace RivWorks.Interfaces.DataContracts
{
    public interface IProduct
    {
        [XmlElement]
        [DataMember(Name = "ID", Order = 0)]
        Guid ProductID { get; set; }
        [XmlElement]
        [DataMember(Name = "altID", Order = 1)]
        long alternateProductID { get; set; }
        [XmlElement]
        [DataMember(Name = "CompanyId", Order = 2)]
        Guid CompanyId { get; set; }
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

具体类定义(缩写):

namespace RivWorks.DTO
{
    [DataContract(Name = "Product", Namespace = "http://rivworks.com/DataContracts/2009/01/15")]
    public class Product : IProduct
    {
        #region Constructors
        public Product() { }
        public …
Run Code Online (Sandbox Code Playgroud)

c# compiler-errors interface

82
推荐指数
3
解决办法
7万
查看次数

80
推荐指数
7
解决办法
3万
查看次数

error :: make_unique不是'std'的成员

我正在尝试编译代码审查上发布的以下线程池程序来测试它.

https://codereview.stackexchange.com/questions/55100/platform-independant-thread-pool-v4

但我得到了错误

threadpool.hpp: In member function ‘std::future<decltype (task((forward<Args>)(args)...))> threadpool::enqueue_task(Func&&, Args&& ...)’:
threadpool.hpp:94:28: error: ‘make_unique’ was not declared in this scope
     auto package_ptr = make_unique<task_package_impl<R, decltype(bound_task)>>  (std::move(bound_task), std::move(promise));
                        ^
threadpool.hpp:94:81: error: expected primary-expression before ‘>’ token
     auto package_ptr = make_unique<task_package_impl<R, decltype(bound_task)>>(std::move(bound_task), std::move(promise));
                                                                             ^
main.cpp: In function ‘int main()’:
main.cpp:9:17: error: ‘make_unique’ is not a member of ‘std’
 auto ptr1 = std::make_unique<unsigned>();
             ^
main.cpp:9:34: error: expected primary-expression before ‘unsigned’
 auto ptr1 = std::make_unique<unsigned>();
                              ^
main.cpp:14:17: error: ‘make_unique’ is not a member …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors unique-ptr c++11 c++14

77
推荐指数
3
解决办法
8万
查看次数

JSLint错误:"将调用移动到包含该函数的parens"

JSLint对此错误的意义是什么?它应该如何改写?

Error: Problem at line 78 character 3: Move the invocation into the parens that contain the function: })(jQuery);

javascript debugging jquery compiler-errors jslint

73
推荐指数
1
解决办法
2万
查看次数

编译错误:"初始化元素不是编译时常量"

编译此代码时,我得到错误"初始化元素不是编译时常量".有谁能解释为什么?

#import "PreferencesController.h"

@implementation PreferencesController

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}


NSImage* imageSegment = [[NSImage alloc] initWithContentsOfFile:@"/User/asd.jpg"];//error here
Run Code Online (Sandbox Code Playgroud)

cocoa compiler-errors initialization global-variables objective-c

73
推荐指数
4
解决办法
10万
查看次数

Xcode 4.1致命错误:自编译预编译头文件以来修改了stdlib

构建iPhone应用程序,使用:

  • Xcode 4.1
  • 基础SDK iOS 4.3
  • Apple LLVM编译器2.1

我开始收到以下错误:

致命错误:自编译预编译头文件以来,文件'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'已被修改

我尝试重新安装Xcode和OS X - 没有运气.是什么导致了这个?

xcode compiler-errors ios

73
推荐指数
4
解决办法
3万
查看次数

为什么gcc允许将参数传递给定义为不带参数的函数?

我不明白为什么这段代码会编译?

#include <stdio.h>
void foo() {
    printf("Hello\n");
}

int main() {
    const char *str = "bar";
    foo(str);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

gcc甚至没有发出警告,我向foo()传递了太多的参数.这是预期的行为吗?

c gcc compiler-errors

73
推荐指数
4
解决办法
4961
查看次数