导入zip文件作为工程的方法:
File->import 展开General,选择Existing Projects into Workspace,点击下一步,选择archieve file,浏览zip文件路径,导入即可。
注意:VC2005中编译,不能有空格和中文路径,否则可能Google Test运行时可能异常。
Eclipse桌面上点击“进入workspace”,可以看到import的工程。
没有找到编译按钮,右键/配置,然后加入了Build configuriton等几个,能找到了。
点击锤子样的编译按钮,发现没任何反应,下面的Console输出窗口为黑色,选中里面的内容居然有错误信息。
第一次错误信息如下,把Dev-CPP的bin路径加入path,重新打开Eclipse之后,这个问题消失。
**** Build of configuration Default for project Temp ****
(Cannot run program "make": Launching failed)
但是,遇到下面错误:
**** Build of configuration MinGW GCC for project AutomatedRefactoring-Problem-Cpp ****
make all
系统找不到指定的路径。
系统找不到指定的路径。
make: *** ../Support-GTest-Cpp/build: No such file or directory. Stop.
make: *** [support] Error 2
显然是相对路径不存在,首先要确定当前路径。
发现Workspace中根目录下就有makefile,猜想用的是它,在里面随便某一行写点东西,编译报告makefile错误,确认了这个事实。
把该makefile中的all改名,然后新写一个all如下:
all: $(shell echo current dir: %cd%)
打印结果如下:
make all
系统找不到指定的路径。
系统找不到指定的路径。
current dir: D:/Users/Jelly/Documents/eclipse_workspace/AutomatedRefactoring-Problem-Cpp
process_begin: CreateProcess((null), current dir:D:/Users/Jelly/Documents/eclipse_workspace/AutomatedRefactoring-Problem-Cpp, ...) failed.
make (e=2): 系统找不到指定的文件。make: *** [all] Error 2
当前路径找到了。
终于能够开始编译了,不过,有编译错误:
g++ -g -Wno-deprecated-declarations -I../include ../src/ILFileUtils.cpp ../src/ILTestInfoWriter.cpp
../src/ILTestListener.cpp ../src/gtest-death-test.cc ../src/gtest-filepath.cc ../src/gtest-port.cc
../src/gtest-typed-test.cc ../src/gtest.cc ../src/gtest_main.cc -c
../src/gtest.cc: In function `testing::internal::TimeInMillis testing::internal::GetTimeInMillis()':
../src/gtest.cc:648: error: `gettimeofday' undeclared (first use this function)
../src/gtest.cc:648: error: (Each undeclared identifier is reported only once for each function it appears in.)
make[1]: *** [../lib/libSupport.a] Error 1
make: *** [support] Error 2