Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
422 views
in Technique[技术] by (71.8m points)

c++ - #include <util/Timer.h> returns fatal error: util/Timer.h: No such file or directory

This is my code. I don't understand why the compiler can't find the <util/Timer.h> header file. What did I do wrong? I have no clue , as <util/Timer.h> is not created within my project. Do I still have to add it in a cmake file as a path? I have already checked for misspelling etc. I get an "no such file or directory warning".

#include <gtest/gtest.h>


#define protected public
#define private public
#include "ShakingDevice.h"
#undef protected
#undef private

#include <limits.h>
#include "TestConfig.h"
#include <util/Timer.h>

class ShakingDeviceTest : public ::testing::Test {
 public:
  ShakingDevice *s = nullptr;

  virtual void SetUp() {
    //
  }

  virtual void TearDown() {
    //
  }
};

TEST_F(ShakingDeviceTest,testTime) {
  ASSERT_LE(abs(time - expected), 100);
}
question from:https://stackoverflow.com/questions/65871436/include-util-timer-h-returns-fatal-error-util-timer-h-no-such-file-or-direc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should check you cmake or PATH in you platform , the reason why "no such file or directory warning". is system cannot find this file by the paths you give , you should add INCLUDE into your cmake file so that the system will know where to find this head file .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...