为什么我使用以下代码收到错误"可能无法初始化可变大小的对象"?
int boardAux[length][length] = {{0}};
Run Code Online (Sandbox Code Playgroud) 我在虚拟环境中使用python 2.7和PyCharm 2.7(2013年2月7日的新版本).
每当我在其中打开一个具有明确错误的python文件(相当于其他语言中的编译错误,例如使用未声明的变量,调用不存在的函数)时,它会在文件的装订线中显示红色条纹.
因此,我偶然发现错误,因为我碰巧导航到包含它们的文件.我真正想要的是能够在单独的窗口中列出所有python错误.Visual Studio 2005/2008/2010/... IDE有一个单独的"错误"视图,其中列出了所有文件名和行号,并使我能够单击这些错误中的任何一个并直接导航到资源.
PyCharm有这样的东西吗?
以下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"的行失败了.他们看起来基本相同.
我有一个包含所有接口定义
的项目: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) 除了-Wall之外,其他人发现的警告有用吗?
http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html
我正在尝试编译代码审查上发布的以下线程池程序来测试它.
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) JSLint对此错误的意义是什么?它应该如何改写?
Error: Problem at line 78 character 3: Move the invocation into the parens that contain the function:
})(jQuery);
编译此代码时,我得到错误"初始化元素不是编译时常量".有谁能解释为什么?
#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
构建iPhone应用程序,使用:
我开始收到以下错误:
致命错误:自编译预编译头文件以来,文件'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'已被修改
我尝试重新安装Xcode和OS X - 没有运气.是什么导致了这个?
我不明白为什么这段代码会编译?
#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()传递了太多的参数.这是预期的行为吗?
compiler-errors ×10
c ×3
gcc ×2
c# ×1
c++ ×1
c++11 ×1
c++14 ×1
cocoa ×1
debugging ×1
interface ×1
ios ×1
java ×1
java-8 ×1
javascript ×1
jquery ×1
jslint ×1
lambda ×1
objective-c ×1
pycharm ×1
python ×1
python-2.7 ×1
unique-ptr ×1
void ×1
xcode ×1