Function 'EXPECT_CALL' could not be resolv

2019-09-05 02:18发布

I am building this project: https://github.com/kaizouman/gtest-cmake-example

on ubuntu 15.10 using cmake, gtest and make. I have used cmake to build eclipse makefiles and project:

enter image description here

I can import the project into Eclipse Mars and it works for the most parts. But in one of the tests I get the following errors:

enter image description here

so some of the gtest macros, e.g. EXPECT_CALL cannot be found/resolved while others can be found e.g.: EXPECT_EQ

Further the function norf() implemented in: ibar.h in libfoo cannot be resolved either: Function 'norf' could not be resolved.

I have tried to refresh the project run make all but the errors persist.

It works fine when I run the make targets from command line (and also from inside eclipse), no compile errors:

[  4%] Built target libfoo
[  9%] Built target libbar
[ 14%] Built target myApp
[ 52%] Built target gmock
[ 90%] Built target gtest
[100%] Built target testfoo
[cmake-test] $ /bin/sh -xe /tmp/hudson4075531494849087103.sh
+ cd cmake-gtest/build
+ make all
[  4%] Built target libfoo
[  9%] Built target libbar
[ 14%] Built target myApp
[ 52%] Built target gmock
[ 90%] Built target gtest
[100%] Built target testfoo
+ make test
Running tests...
Test project /var/lib/jenkins/workspace/cmake-test/cmake-gtest/build
    Start 1: testfoo
1/1 Test #1: testfoo ..........................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.01 sec
Finished: SUCCESS

So why the errors in the editor in eclipse?

Might be that I am missing something basic here but it seems strange that its only some parts that cannot be resolved. It also only seems to be related to eclipse integration.

Any suggestions?

0条回答
登录 后发表回答