2011-04-09 2 views
0

xcode에서 unity3d 프로젝트를 컴파일하려고 시도했지만 아래 함수에서 다음과 같은 컴파일 오류가 발생합니다. 그 원인이 누구인지 압니까? 엑스 코드 4 사용함수 선언자 다음에 예상되는 함수 본문

가 SDK 4.3 유니티가 3.3 자료 SDK가 4.3로 설정되어 화합 SDK 버전은 상기 이전 3.2

AppController.mm:710: error: expected initializer before '.' token

AppController.mm: error: Parse Issue: Expected function body after function declarator

void PresentContext_UnityCallback(struct UnityFrameStats const* unityFrameStats) 
    { 
    #if ENABLE_INTERNAL_PROFILER 
     _unityFrameStats = *unityFrameStats; 

     if (_frameId % BLOCK_ON_GPU_EACH_NTH_FRAME == (BLOCK_ON_GPU_EACH_NTH_FRAME-1)) 
     { 
      Prof_Int64 gpuTime0 = mach_absolute_time(); 

    #if ENABLE_BLOCK_ON_GPU_PROFILER 
      UnityFinishRendering(); 
    #endif 

      Prof_Int64 gpuTime1 = mach_absolute_time(); 
      _gpuDelta = gpuTime1 - gpuTime0; 
     } 
     else 
      _gpuDelta = 0; 
    #endif 


    #if ENABLE_INTERNAL_PROFILER 
     Prof_Int64 swapTime0 = mach_absolute_time(); 
    #endif 

     PresentSurface(_surface); 

    #if ENABLE_INTERNAL_PROFILER 
     Prof_Int64 vblankTime = mach_absolute_time(); 

     if (_lastVBlankTime < 0) _lastVBlankTime = vblankTime; 
     _frameDelta = vblankTime - _lastVBlankTime; _lastVBlankTime = vblankTime; 

     Prof_Int64 swapTime1 = vblankTime; 
     _swapDelta = swapTime1 - swapTime0; 
    #endif 
    } 

코드 4.2 및 대상 아이폰 OS에 설정된 함수는 다음과 같습니다 :

void PresentSurface(MyEAGLSurface& surface) 
{ 
    UNITY_DBG_LOG ("PresentSurface:\n"); 
    EAGLContext *oldContext = [EAGLContext currentContext]; 

    if (oldContext != _context) 
     [EAGLContext setCurrentContext:_context]; 

#if GL_APPLE_framebuffer_multisample 
    if (surface.msaaSamples > 0 && _supportsMSAA) 
    { 
     UnityStartProfilerCounter(msaaResolveCounter); 
     #if ENABLE_INTERNAL_PROFILER 
     Prof_Int64 msaaTime0 = mach_absolute_time(); 
     #endif 

     UNITY_DBG_LOG (" ResolveMSAA: samples=%i msaaFBO=%i destFBO=%i\n", surface.msaaSamples, surface.msaaFramebuffer, surface.framebuffer); 
     glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, surface.msaaFramebuffer); 
     glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, surface.framebuffer); 

     glResolveMultisampleFramebufferAPPLE(); 
     CHECK_GL_ERROR(); 

     #if ENABLE_INTERNAL_PROFILER 
     _msaaResolve += (mach_absolute_time() - msaaTime0); 
     #endif 
     UnityEndProfilerCounter(msaaResolveCounter); 
    } 
#endif 

#if GL_EXT_discard_framebuffer 
    if (_supportsDiscard) 
    { 
     GLenum attachments[3]; 
     int discardCount = 0; 
     if (surface.msaaSamples > 1 && _supportsMSAA) 
      attachments[discardCount++] = GL_COLOR_ATTACHMENT0_OES; 

     if (surface.depthFormat) 
      attachments[discardCount++] = GL_DEPTH_ATTACHMENT_OES; 

     attachments[discardCount++] = GL_STENCIL_ATTACHMENT_OES; 

     GLenum target = (surface.msaaSamples > 1 && _supportsMSAA)? GL_READ_FRAMEBUFFER_APPLE: GL_FRAMEBUFFER_OES; 
     if (discardCount > 0) 
      glDiscardFramebufferEXT(target, discardCount, attachments); 
    } 
#endif 

    CHECK_GL_ERROR(); 

    // presentRenderbuffer presents currently bound RB, so make sure we have the correct one bound 
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, surface.renderbuffer); 
    if(![_context presentRenderbuffer:GL_RENDERBUFFER_OES]) 
     EAGL_ERROR("swap renderbuffer"); 

#if GL_APPLE_framebuffer_multisample 
    if (_supportsMSAA) 
    { 
     const int desiredMSAASamples = UnityGetDesiredMSAASampleCount(MSAA_DEFAULT_SAMPLE_COUNT); 
     if (surface.msaaSamples != desiredMSAASamples) 
     { 
      surface.msaaSamples = desiredMSAASamples; 
      CreateSurfaceMultisampleBuffers(&surface); 
      glBindRenderbufferOES(GL_RENDERBUFFER_OES, surface.renderbuffer); 
     } 

     if (surface.msaaSamples > 1) 
     { 
      glBindFramebufferOES(GL_FRAMEBUFFER_OES, surface.msaaFramebuffer); 
      gDefaultFBO = surface.msaaFramebuffer; 
      UNITY_DBG_LOG (" glBindFramebufferOES (GL_FRAMEBUFFER_OES, %i); // PresentSurface\n", surface.msaaFramebuffer); 
     } 
    } 
#endif 

    if(oldContext != _context) 
     [EAGLContext setCurrentContext:oldContext]; 
} 
+0

전혀 없습니다 된 벌브 수 있습니다 '를.' 게시 한 스 니펫에 토큰 (첫 번째 오류)이 있으므로이 메시지는 후속 오류이며 해당 문제는 인용 한 코드 전 *임을 나타냅니다. – CRD

+0

코드를 수정했지만 #if 문은 레이아웃을 망칠 수 있습니다. – Zophiel

+0

@Zophiel. 코드 형식을 수정하십시오. '# if' 문이 레이아웃을 "망가뜨린"이유는 완전히 들여 쓰기가 어렵 기 때문입니다. 자세한 내용은 http://daringfireball.net/projects/markdown/syntax#precode를 참조하십시오. –

답변

0

본질적으로 Unity 3.3에는 문제가 있습니다. 어쨌든 iOS 용 플레이어 설정으로 이동하여 "4.2"에서 "4.2 이후의 최신"으로 태그 라이브러리 SDK 값을 다시 조정하면 쉽게 해결할 수 있습니다.

0

방금 ​​변수 앞에있는 &을 삭제했습니다. .. 지금은

0

내 Prefix.pch에 두 줄을 다음과 같은 추가가

#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_4_2 
#define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_3_0