注意:我之前从未遇到过这种规模的问题,并且真的不知道如何解决这个问题,如果我把它弄错了那么请解释我应该如何解决它.如果您不能或不会帮助该计划,我很高兴只是了解这个问题.
我一直在编写一段代码来练习面向对象的编程,但是我遇到了一个我以前从未见过的错误(我已经在这里工作了几个月并且没有花很多时间来学习,因为我的时间浪费在义务教育上).内核本身(显然)用我的代码产生了这个错误.但是运行gdb(带有调试符号)并没有让我知道行号.在printf语句中显示,即使条件不再满足,它也会循环一个while循环?这对我来说似乎很奇怪,因为看起来条件不满足,但它仍然循环.它发生错误(我想)发生这种情况的原因是因为它在"Stack"类中的某个地方为整数数组重新分配负大小的内存 - 但是,当我向Stack :: reloc添加if语句以便防止它重新定位负数组大小它仍然会导致错误.向下看它会显示其他几条信息,(引用gdb):
程序接收信号SIGABRT,已中止.__kernel_vsyscall()中的0x0012d422
我没有从SIGABRT的wiki页面中学到太多东西,我不认为十六进制数对我来说意味着什么.这是我的代码,分为两个类和main:
标题:
#include <cstdio>
#include <cstdlib>
Run Code Online (Sandbox Code Playgroud)
类Stack:
class Stack {
private:
int *stack;
int size;
void init(int *top) {
*top = 0;
}
void push2(int *s,int* top, int element) {
s[(*top)++] = element;
}
int pop2(int *s,int *top) {
return s[--(*top)];
}
void reloc(int diff) {
if ((top+diff)>1) {
realloc(stack, (size+diff));
size = size+diff;
}
}
public:
int top;
Stack() {
init(&top);
size = 100;
stack = (int *)malloc(100 * sizeof(int));
}
void …Run Code Online (Sandbox Code Playgroud) 我是Xcode的新手,我的应用程序运行在最新版本的Xcode上有错误,当我尝试运行我的应用程序时收到此错误.线程1:编程接收信号:"SIGABRT".在调试器中我得到了这个,终止调用了一个异常的当前语言:auto; 目前客观的c.所有帮助将不胜感激,谢谢!
我的程序有这个小问题。在 Visual Studio 2012 中它运行良好,但是如果我用 G++ 编译它(是的,由于我上面的原因,我必须使用它来编译),错误信号 11(SIGSEGV) 或 6(SIGABRT) 根据输入被触发. 这是一个编程练习,我有另一个程序(在在线服务器上)用 10 个不同的输入测试我的程序。正如我所说,该程序在使用 Visual Studio 2012 时编译并运行良好。
关于程序:它找到从起点(x,y)到多个出口的最短路径(出口数量无关且不同。可能只有1个出口,也可能有200个)。输入如下:
7 12 // maze height and width
##########.# //
#..........# //
#.###.###### //
#..X#.#..... // the maze blueprint
#.###.#.#### //
#..........# //
############ //
Run Code Online (Sandbox Code Playgroud)
还有我的程序:
#include <iostream>
#include <vector>
typedef struct _laby_t {
int h, w;
char **pohja; // 'pohja' is finnish and means layout
} laby_t;
typedef std::vector<int> monovector;
typedef std::vector< std::vector<int> > bivector;
laby_t *laby_allocate (int r, int c) …Run Code Online (Sandbox Code Playgroud) 当我运行我的应用程序时,我找到一个信号SIGABRT线程.以下是错误消息:[__ NSCFConstantString _isResizable]:无法识别的选择器发送到实例0x5c20
问题来自[[self myCollectionView] setDataSource:self]; 因为它在评论时消失了.
根据我的理解,myCollectionView数据源和self的类型不一样.这就是我有错误的原因.
谢谢你的帮助
皮埃尔
CalViewController.h
#import <UIKit/UIKit.h>
@interface CalViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegate>
@property (weak, nonatomic) IBOutlet UICollectionView *myCollectionView;
@end
Run Code Online (Sandbox Code Playgroud)
CalViewController.m
#import "CalViewController.h"
#import "CustomCell.h"
@interface CalViewController ()
{
NSArray *arrayOfImages;
NSArray *arrayOfDescriptions;
}
@end
@implementation CalViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[[self myCollectionView]setDataSource:self];
[[self myCollectionView]setDelegate:self];
arrayOfImages = [[NSArray alloc]initWithObjects:@"chibre.jpg",nil];
arrayOfDescriptions =[[NSArray alloc]initWithObjects:@"Test",nil];
}
- (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [arrayOfDescriptions count];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier=@"Cell"; …Run Code Online (Sandbox Code Playgroud) 它已经过了1周,我仍然停留在PFImageView上.我重新制作了一切.从UITableView更改为PFQueryTableView,然后尝试使用UITableViewCell显示图像,然后使用PFTableViewCell,并且在每种方法中,只有用于显示的内容才是标签.每当我运行我的应用程序时,我都会因为这行而崩溃(SIGABRT):`
崩溃线
Run Code Online (Sandbox Code Playgroud)cell.imagevieww.file= [object objectForKey:@"ImageURL"]; [cell.imagevieww loadInBackground];
任何人都可以帮我解决这个问题吗?非常感谢
TableViewController.h
Run Code Online (Sandbox Code Playgroud)#import <Parse/Parse.h> #import "Customcell.h" #import "DetailViewController.h" @interface TableeViewController : PFQueryTableViewController { NSArray *colorsArray; } @property (strong, nonatomic) IBOutlet UITableView *colorsTable; @end
TableViewController.m
#import "TableeViewController.h"
#import "TableViewCell.h"
#import "DetailViewController.h"
@interface TableeViewController ()
@end
@implementation TableeViewController
@synthesize colorsTable;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (id)initWithCoder:(NSCoder *)aCoder
{
self = [super initWithCoder:aCoder];
if (self) {
// The className …Run Code Online (Sandbox Code Playgroud) 我的应用程序崩溃了错误代码:SIGABRT.我做了大量的研究,没有一个"SIGABRT解决方案"曾经帮助过.这是iOS模拟器上应用程序崩溃后控制台中的内容:
Terminating app due to uncaught exception
'NSInternalInconsistencyException',
reason: '-[UIViewController _loadViewFromNibNamed:bundle:]
loaded the "ViewController" nib but the view outlet was not set.'
Run Code Online (Sandbox Code Playgroud)
如果有人能帮助我那将是伟大的!