...`

2017-03-06 1 views
-1

나는이 컴파일러 오류 얻을 때 grpc 서버에 연결 QtCreator에서 C++로 코드를 작성하는 것을 시도하고있다 :...`

/some/path/serverproxy.cpp:40: error: undefined reference to `grpc::InsecureChannelCredentials()' 

을 여기 내 grpcserverproxy.cpp

#include <grpc++/channel.h> 
#include <grpc++/create_channel.h> 
#include <grpc++/security/credentials.h> 

의 상단에 포함이고 오류가이 라인에서 온다 :

somenamespace::NewStub(
     grpc::CreateChannel("someaddress", 
          grpc::InsecureChannelCredentials()))}; 

기존 파일을 추가하고이 헤더를 QtCreator에 추가하려고 시도했지만 (모든 외부 라이브러리의 헤더를 수동으로 처리해야한다는 것은 매우 이상 할 수 있지만) 작동하지 않았습니다. 그들은 /usr/local/include/grpc++/**/*.h에 있습니다. 내 .pro 파일에 INCLUDEPATH += /usr/local/include을 추가하려고 시도했습니다.

qmake을 실행하고 다시 빌드하면 프로젝트를 청소하려고 시도했습니다.

이러한 grpc++ 기능을 사용하려면 무엇을해야합니까?

답변

0

내가 마지막으로 undefined reference 오류를 제거있어 무엇 인 here을보고있는이 몰래 많은 undefined reference in qtcreator 스레드를 보았다 :

You are facing a link error. Just add in your .pro the path to your lib and its name with :

LIBS += -L<path_to_the_lib> -l<libName>

특히

LIBS += -L/usr/local/include/grpc++ -lgrpc++