Project dependency in Eclipse CDT

前端 未结 5 1885
走了就别回头了
走了就别回头了 2020-12-29 03:44

I\'m using eclipse for the first time. I\'m a seasoned VisualStudio user, so I\'m trying to find similar functionality in eclipse. I have two projects, A and B. Project A sp

5条回答
  •  执笔经年
    2020-12-29 03:58

    One can work around this problem by using the touch command.

    In Eclipse, as part of C/C++ Build/Settings is the tab 'Build Steps'. In the pre-build steps command line, enter touch filename.

    filename is any file in your application. This could be the file with main(). This could be a special file just for this workaround, touchdummy.c, which can be a tiny file, which compiles quickly.

    When the application builds, even if you didn't change any sources, the touch command causes make to rebuild the application. If the library was rebuilt, then the application gets rebuilt with the new library.

    One can read about how touch affects the date/time of the file here. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

    Edit: The exact command in Eclipse would be touch ${ProjDirPath}/src/main.c

    Edit: This command should work, but it appears that if the 'main' project did not change, the pre-build step is not executed. Also the touch command causes eclipse to prompt to reload the file it touched. A large annoyance.

提交回复
热议问题