Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Launch external translator program according file extension(How can I launch flex/bison(p.ex.) automatically during build)
Launch external translator program according file extension [message #1828351] Mon, 08 June 2020 09:30 Go to next message
Charly Clément is currently offline Charly ClémentFriend
Messages: 5
Registered: June 2020
Junior Member
My problem is yet simple, but I cannot find any pertinent information about it :

According the extension of a file in a CDT C/C++ project, I would like to launch a specific program.

My goal is to launch flex, bison, with parameters arising from current filename, current project location,... (for which variables exists), for files in my project, which have respectively the extensions ".L" an ".Y" (by example).

So simple that I ask me if I am missing something obvious.
Thanks in advance for your answers,
Charly C.
Re: Launch external translator program according file extension [message #1828361 is a reply to message #1828351] Mon, 08 June 2020 14:12 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
When and how would this be launched?

  1. During an edit?
  2. Automatically just before a build?

For (1) I think you are looking for Run --> External Tools
For (2) assuming you are using a Managed Build, I think you want Project --> Properties --> C/C++ Build --> Settings --> Build Steps tab
otherwise, you should add it to your Makefile

For it to run different things based upon extent, it would likely have to be a script (Perl, bash, etc.)

The documentation for External Tools is rather sparse:
https://help.eclipse.org/2020-03/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-exttools-running.htm

The Build Steps documentation is
https://help.eclipse.org/2020-03/topic/org.eclipse.cdt.doc.user/reference/cdt_u_prop_build_settings_steps.htm?cp=10_4_7_0_3_3_1
Be aware that the pre- and post-build steps are run for every build whether needed or not.


[Updated on: Mon, 08 June 2020 14:30]

Report message to a moderator

Re: Launch external translator program according file extension [message #1828377 is a reply to message #1828361] Mon, 08 June 2020 16:22 Go to previous messageGo to next message
Charly Clément is currently offline Charly ClémentFriend
Messages: 5
Registered: June 2020
Junior Member
Hello David,
Thanks for your answer.

I effectively looked around the "External Tools" and (pre-)"Build Step". I probably could solve my need with one of them.

However, I use "Managed Build", and precisely because of that, I expected to find a more "Nice to Have" functionality, allowing to configure the following behavior :
1) When I build the whole project, the builder automatically calls the external program, according to the file extension, as pre or post build.
2) When I "right-click" on such a file in the project browser, the usual contex-menu allow me to "Build Selected File", calling the adequate external program.

What is your opinion ? :
- Does a such behavior just ready and easy to configure in CDT ?
- Which piece of Eclipse Software handles this kind of behavior (CDT, Builder, Toolchain,....) ?
- What would involve to realize such functionality ?

Remark / Need Help :
I am totally confused with these notions of Builder, Toolchain, CDT, extensions,....
Who implements what ? Who calls what ? What involves customizing / extending any of them ?
Eclipse offers such an amount of tools, apis, frameworks, to help realize extensions, plugins, scripting,.... that I am totally lost.

Thanks in advance if somebody has time and patience for explain me the "essential" about my Interrogations.
Re: Launch external translator program according file extension [message #1828379 is a reply to message #1828377] Mon, 08 June 2020 17:33 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
(1) Exists but is independent of file extent.
(2) Does not exist but might make a decent enhancement although the context menu is already rather large

A Managed Build Project is a project that creates makefiles to be run by make. The makefiles it generates are somewhat limited but often provide enough for the casual user. I prefer to create my own makefiles.

Builder: An unfortunate name in my opinion. A program run at specified times by Eclipse during a build.
Pre- and Post-build step: a step added to a makefile
Toolchain: the set of external tools used to make a target (compiler, assembler, linker, etc.) used in makefile recipes. Generally only needed by Managed Build Projects.
Extentions and Plugins: this link might help https://www.vogella.com/tutorials/EclipseExtensionPoint/article.html
and https://help.eclipse.org/2020-03/nav/14

Suggest you read:
https://help.eclipse.org/2020-03/nav/0
https://help.eclipse.org/2020-03/nav/2

[Updated on: Mon, 08 June 2020 17:51]

Report message to a moderator

Previous Topic:Making a new idf project - are there any instructions?
Next Topic:-g3 debug not work,when list.push_back
Goto Forum:
  


Current Time: Wed Apr 24 14:52:33 GMT 2024

Powered by FUDForum. Page generated in 0.02340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top