简体   繁体   English

Eclipse CDT生成后命令错误

[英]Eclipse CDT Post-Build commands error

I have a C++ project and I´m using Eclipse CDT 3.8.1 as the IDE tool, with a workspace of 5 different projects... 我有一个C ++项目,我使用Eclipse CDT 3.8.1作为IDE工具,并具有5​​个不同项目的工作区...

One of my projects is a shared library, and at the end of compilation I want to copy its code to a test/bin directory for testing. 我的项目之一是共享库,在编译结束时,我想将其代码复制到test / bin目录进行测试。

I´ve gone to Project Properties -> C/C++ Build -> Settings -> Build Steps and at "Post-build steps", "Command", I´ve added: 我进入了“项目属性”->“ C / C ++构建”->“设置”->“构建步骤”,并在“构建后步骤”,“命令”处添加:

cp *.so ../../../bin

(OBS: ../../../bin is the correct path from the Debug folder - I´ve checked already). (OBS:../../../ bin是Debug文件夹中的正确路径-我已经检查过)。

What happens is that I get the following error on post build: 发生的是,在构建后出现以下错误:

cp *.so ../../../bin 
cp: cannot stat ‘*.so’: No such file or directory

I said: ok, this may be a permission problem, so I changed the post commands to: 我说:好的,这可能是权限问题,所以我将post命令更改为:

whoami;ls -al; ls *.so;

And I got on Eclipse console: 我进入了Eclipse控制台:

    whoami 
    aeidev
    ls -al 
    total 264
    drwxrwxr-x 3 aeidev aeidev   4096 Apr 25 15:55 .
    drwxrwxr-x 5 aeidev aeidev   4096 Apr 22 16:27 ..
    -rwxrwxr-x 1 aeidev aeidev 242556 Apr 25 15:55 libaeirtuaccess.so
    -rw-rw-r-- 1 aeidev aeidev   1763 Apr 23 20:47 makefile
    -rw-rw-r-- 1 aeidev aeidev    245 Apr 23 20:46 objects.mk
    -rw-rw-r-- 1 aeidev aeidev    526 Apr 23 20:47 sources.mk
    drwxrwxr-x 2 aeidev aeidev   4096 Apr 25 15:41 src
     ls *.so 

15:55:11 Build Finished (took 1s.80ms)

And them I changed again to ls *.so and I got: 然后我再次将它们更改为ls *.so ,我得到了:

ls -al *.so 
ls: cannot access *.so: No such file or directory

15:57:50 Build Finished (took 715ms)

It´sa very strange behaviour. 这是一个非常奇怪的行为。 In the same workspace I have a different shared library and the original cp *.so works fine... 在同一工作区中,我有一个不同的共享库,原始的cp *.so可以正常工作...

Any ideas of what´s going on here ? 对这里发生的事情有任何想法吗? Is it a known Eclipse bug ? 这是已知的Eclipse错误吗?

Thanks for helping... 感谢您的帮助...

I believe the commands are not executed in a shell by default, so wildcards are not evaluated. 我相信默认情况下命令不会在外壳程序中执行,因此不会评估通配符。 Try executing like /bin/sh -c 'cp *.so ../../../bin/' . 尝试像/bin/sh -c 'cp *.so ../../../bin/' Also you should use Eclipse's built-in variables to copy to the desired path. 另外,您应该使用Eclipse的内置变量将其复制到所需的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM