使用eclipse编译C++工程。

导入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

Digg This
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值