Ubuntu下使用Eclipse编译一个基于makefile的C项目

【背景】

折腾完:

【记录】Ubuntu中下载和安装Eclipse

后,就可以去折腾,用Eclipse编译项目了。

 

【折腾过程】

1.继续正常的导入项目:

file import

2。

general existing projects into workspace

3.

for select root directory browse

4.但是只检测出来一个子项目WHGS:

only whgs detected out

5.后来是重新解压了项目源码,使其项目根目录下包含了那个.project和.cproject:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

crifan@ubuntu:WiHART_Gateway_6_0$ ls -lha

total 80K

drwxrwxr-x 5 crifan crifan 4.0K Jul 21 18:30 .

drwxrwxr-x 3 crifan crifan 4.0K Jul 21 18:28 ..

drwxrwxr-x 6 crifan crifan 4.0K Jul 21 18:29 BSP

-rwxrwxr-x 1 crifan crifan 4.6K Jun  3 23:24 .cproject

-rwxrwxr-x 1 crifan crifan 2.3K Mar 12 07:56 .project

drwxrwxr-x 7 crifan crifan 4.0K Jul 21 18:29 WBM

drwxrwxr-x 7 crifan crifan 4.0K Jul 21 18:30 WHGS

-rwxrwxr-x 1 crifan crifan  47K Jun  4 06:24 WHGS_1

crifan@ubuntu:WiHART_Gateway_6_0$ pwd

/home/crifan/develop/crosscompile/wihart_gateway_6_0/WiHART_Gateway_6_0/WiHART_Gateway_6_0

crifan@ubuntu:WiHART_Gateway_6_0$

然后Eclipse才能正常识别:

re use new project now can found

 

6.现在去尝试,如何用Eclipse编译带makefile的C项目。

try make targets create

7.创建一个all的target试试:

create make target all

 

8.

再试试:

Make Targets -> Build

try make targets build

 

9.然后选择之前建的all,然后build:

choose all build

10.然后出现和之前,在命令行下面make时:

【已解决】用arm-xscale-linux-gnueabi编译代码出错:error: lvalue required as unary ‘&’ operand

的一样的错误:

same error with before lvalue required as unary

所以,就去修改对应的文件,改掉此错误。

然后对于出错的位置,双击,或右键选择Goto,可以直接定位到该错误为值。

然后去修改。

11.把所有的

lvalue required as unary ‘&’ oprand

都改掉后,然后继续重新去编译,结果还有其他错误:

【已解决】Eclipse通过Makefile调用交叉编译器交叉编译C项目出错:Type ‘FILE’ could not be resolved

12.注意:

实际上,此处,已经可以获得编译出来的目标程序了。

所以,即使最后解决不了问题,也是可以的接受的。

即使解决了上述”Type ‘FILE’ could not be resolved“的问题,还有其他很多问题:

【已解决】Eclipse中交叉编译C项目出错:Symbol ‘SETVAL’ could not be resolved

13.但是解决了上述一堆的符合没找到后,还是有NULL找不到的问题:

【已解决】Ubuntu下Eclipse中交叉编译C项目出错:Symbol ‘NULL’ could not be resolved

14.基本上解决所有error了,还有最后一个:

【已解决】Ubuntu下Eclipse中交叉编译C项目出错:Symbol ‘off’ could not be resolved

15.最后,算是解决了,和当前WBM的所有的错误了。

只是,Eclipse还会自动的,对于别的项目,搞出来一堆错误。。。

不理会了。

因为当前项目,是正常编译了:

build wbm ok generate file

16.此处,暂时是可以编译WBM了。

接着可以继续去弄WHGS了。

然后也是一堆的:

lvalue required as unary ‘&’ operand

解决后,继续编译,就可以变成成功了。

make all generated file

至此,就可以正常,在Ubuntu下的Eclipse去调用makefile去编译了。

 

【总结】

此处,拿到已有的基于Makefile的C项目,在Ubuntu下,用Eclipse去编译,主要步骤是:

1.先找到对应的makefile,然后点击右键,去create目标,对应此处的,一个是clean,一个是all;

2.然后给项目,添加对应的include文件夹,包括xxx/include,和xxx/include/linux

 

3.然后就可以点击项目(或者makefile文件)去make target->build->选择clean去清除,或者选择all去编译了。

4.正常的话,生成的文件,(根据当前makefile),是放在和makefile同目录下的文件夹里的。

至此,完成了基于Eclipse去使用makefile编译文件。

和命令行下面去:

make clean

make all

是基本一致的。

转载请注明:在路上 » 【记录】Ubuntu下使用Eclipse编译一个基于makefile的C项目

ps:网址链接:

https://www.crifan.com/under_ubuntu_compile_project_using_eclipse/

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值