2012-10-21 6 views
3

Google에서 프로토콜 버퍼를 사용하여 응용 프로그램 용 저장 파일을 구현하려고합니다.생성 된 Protobuf 코드가 응용 프로그램을 충돌 함

간단한 테스트 .proto 파일이 기능을 테스트하기 위해 만들어졌습니다

준비 :

message LessonFile { 
    optional string creator = 1; 
} 

만든 .pb.cc 및 프로젝트에 .pb.h 포함되어 있습니다. Lib W include 디렉토리는 프로젝트의 특성에 지정됩니다.

런타임 동안 프로젝트 결과 응용 프로그램 충돌에 새로 생성 된 코드를 포함하여 문제
. 충돌 상태를 디버깅함으로써

는,이 기능을 지적했다 :

UnknownFieldSet::UnknownFieldSet() 
    : fields_(NULL) {} ---------here--------- 

동안의 점 위에 프레임 :

LessonFile::LessonFile() 
    : ::google::protobuf::Message() { ---------here--------- 
    SharedCtor(); 
} 

콜 스택 :

google::protobuf::UnknownFieldSet::UnknownFieldSet (this=0x770e3cc3) 
LessonFile (this=0xba64b30) protobuf_AddDesc_LessonFile_2eproto() 
StaticDescriptorInitializer_LessonFile_2eproto (this=0x4bc108) 
__static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) global constructors keyed to _Z38protobuf_AssignDesc_LessonFile_2eprotov() 
__do_global_ctors() 
__mingw_CRTStartup() WinMainCRTStartup() 

추가 정보
En vironment : 넷빈; Windows7-64; Qt-4.8.1 + mingw, protobuf-2.4.1. 메이크업 체크는 끊임없이이 메시지와 함께 실패합니다 :

In file included from ./include/gtest/gtest-param-test.h:159:0, from ./include/gtest/gtest.h:59, from src/gtest.cc:34: ./include/gtest/internal/gtest-param-util-generated.h: In instantiation of ::operator testing::internal::ParamGenerator() const [with T = bool; T1 = bool; T2 = bool]>: ./include/gtest/gtest-param-test.h:1186:28:
required from here ./include/gtest/internal/gtest-param-util-generated.h:80:26: error: was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from ./include/gtest/gtest.h:59:0, from src/gtest.cc:34: ./include/gtest/gtest-param-test.h:288:58: note: testing::internal::ParamGenerator testing::ValuesIn(const Container&)> declared here, later in the translation unit

하지만 라이브러리protoc.exe이이 성공적으로 컴파일하고 생성이 디렉토리를 포함 설치하기
또한 Protobuf 컴파일 과정에 문제가 있었다 및 lib * .a/lib * .dll.a 파일. 미래의 시청자에 대한 대답으로 전환

+0

나는 똑같은 문제가 있었다. 제 경우에는 libprotobuf를 QT와 다른 버전의 mingw로 컴파일했기 때문에 컴파일되었습니다. QT Creator와 함께 제공되는 mingw로 libprotobuf를 컴파일했습니다 ...문제는 사라졌습니다. QT Creator를 사용하지 않을 때 이것이 당신에게 적용되는지 확실하지 않습니다. –

+0

나는 Madde shell (Qt에 포함되어 있음)을 사용하여 Protobuf를 다시 컴파일했습니다. 또한 추가 구성 매개 변수를 사용합니다 : ./configure --prefix =/c/QtSDK/mingw/ 그래도 결과는 동일합니다. 실행이 실패하고 Protobuf에서 * 확인 확인 *을 관리 할 수 ​​없습니다. 또한 앱 종료시 오류 코드 (0xc0000005)가 "메모리 액세스 위반"으로 정의 된 것으로 보입니다. 어쩌면 누군가가 이런 유형의 오류에 대해 아는 것일 수 있습니다. –

+0

구성 프로세스를 추적하려고하는데 ./configure가 C :/QingSDK/mingw 대신 C :/mingw와 함께 작동하는 것 같습니다. 두 라이브러리 모두 다릅니다 : 4.7.x 및 4.4.0. QtSDK에서 강제로 작동하도록하는 방법에 대한 조언이 있습니까? –

답변

0

댓글 :

  1. 다운로드는 MinGW + MSYS 패키지는 다음을 설치합니다.
  2. MingW의 설치 폴더에있는 "msys"폴더를 "C : \ msys"에 복사하고 "C : \ msys"에있는 "mingw"폴더를 삭제하십시오.
  3. 편집 "C : \ MSYS \ 등 \ fstab에"에서 "C :/QtSDK /와 Mingw /와 Mingw"
  4. 복사에 "C : \ MSYS \ 홈 \"를 protobuf 소스
  5. 열고 MSYS는 쉘, CD를 "/ 홈 // protobuf"
  6. http://eschew.wordpress.com/2009/09/20/building-protobuf-with-mingw-gcc-4-4-0/ - 아이템 # 2
  7. 실행
  8. 실행
  9. 수동으로 QT에 생성 된 라이브러리 파일을 복사 "확인" "--disable-공유 ./configure 아마" 라이브러리 디렉토리 (헤더 파일뿐만 아니라 디렉토리 구조 유지)
관련 문제