임collect2 : ld가 Xcode에서 종료 상태 오류 1을 반환했습니다.
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
전체 로그가 열렸을 때 오류는 다음과 같이보다 정확하게 표시됩니다.
collect2: ld returned 1 exit status
이 간단한 코코아 스크립트에서 가져온 것입니다 :
#import "Controller.h"
@implementation Controller
int skillcheck (int level, int modifer, int difficulty)
{
if (level + modifer >= difficulty)
{
return 1;
}
if (level + modifer <= difficulty)
{
return 0;
}
}
int main()
{
skillcheck(10, 2, 10);
}
@end
the. h 파일은 다음과 같습니다.
//
// Controller.h
//
// Created by Duo Oratar on 15/01/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface Controller : NSObject
{
int skillcheck;
int contestcheck;
}
@end
오류가 발생한 줄을 지정하지 않았습니까?이 오류의 원인을 누구나 알 수 있습니까? 더 중요한 것은 어떻게 수정해야합니까?
이제 클래스를 제거했습니다.
//
// Controller.m
//
// Created by Duo Oratar on 15/01/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "Controller.h"
int skillcheck (int level, int modifer, int difficulty)
{
if (level + modifer >= difficulty)
{
return 1;
}
if (level + modifer <= difficulty)
{
return 0;
}
}
int main()
{
skillcheck(10, 2, 10);
}
및 .h 파일에 대해 :
//
// Controller.h
//
// Created by Duo Oratar on 15/01/2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
및 로그는 다음과 같습니다.
빌드/디버그/Calculator.app/내용/MacOS/계산기 일반 x86_64 cd/Users/kids/Desktop/계산기 setenv MACOSX_DEPLOYMENT_TARGET 10.6 /개발자/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/kids/Desktop/계산기/빌드/디버그 -F/사용자/키즈/데스크톱/계산기/빌드/디버그 -filelist/사용자 /kids/Desktop/Calculator/build/Calculator.build/Debug/Calculator.build/Objects-normal/x86_64/Calculator.LinkFileList -mmacosx-version-min = 10.6 -framework Cocoa -o/Users/kids/Desktop/Calculator/빌드/디버그/Calculator.app/내용/MacOS/계산기
ld :/사용자/키즈/데스크톱/계산기/빌드/Calculat 중복 기호 _main or.build/Debug/Calculator.build/Objects-normal/x86_64/Controller.o 및 /Users/kids/Desktop/Calculator/build/Calculator.build/Debug/Calculator.build/Objects-normal/x86_64/main.o collect2 : ld가 1 종료 상태를 반환했습니다. 명령 /Developer/usr/bin/gcc-4.2가 종료 코드 1과 함께 실패했습니다.
ld : 중복 기호 _main /Users/kids/Desktop/Calculator/build/Calculator.build/ Debug/Calculator.build/Objects-normal/x86_64/Controller.o 및 /Users/kids/Desktop/Calculator/build/Calculator.build/Debug/Calculator.build/Objects-normal/x86_64/main.o
/developer/usr/bin/gcc-4.2 명령이 종료 코드 1에 실패했습니다.
Controller.m이 현재 대상입니까? –
"더 정확하게"? 정말로 - 우리가 더 많은 로그를 볼 수 있을까요? – trojanfoe
빌드 결과를 열면 오류 오른쪽에 여러 줄의 텍스트처럼 보이는 작은 단추가 표시됩니다. 그것을 클릭하면 실패까지 이어지는 전체 텍스트가 표시됩니다. 그것이 우리가 돕기 위해 필요한 것입니다. – andyvn22