Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to process files in alphabetical order.
How to process files in alphabetical order. [message #1015593] Fri, 01 March 2013 10:15 Go to next message
Tamas Csabina is currently offline Tamas CsabinaFriend
Messages: 28
Registered: November 2012
Junior Member
I have a C project with around 130-150 files. These sources and headers are organized in 10 directories, under my project.
Whenever I build the project, the project files being compiled in an absolute random order. And this random order is being used during linking (the order of the object files are random each time).

And it is not just random order of the directories, but also some files are compiled first from dirA, then some files from dirC, then some files fir dirB, then again some files from dirA.


Is there a way to force this to be alphabetical order? I want the first directory (in the alphabetical order) to be processed by the compiler first, and within this directory first compile the first file (in the alphabetical order). Or at least modify the linker`s command line to contain the object files in alphabetical order.



To make this more clear:
currently to compile order:
compiler <options> /adirectory/aasource.c
compiler <options> /cdirectory/casource.c
compiler <options> /adirectory/acsource.c
compiler <options> /bdirectory/basource.c
compiler <options> /bdirectory/bbsource.c
compiler <options> /adirectory/absource.c

and the link command
linker <options> /adirectory/aasource.o /cdirectory/casource.o /adirectory/acsource.o /bdirectory/basource.o /bdirectory/bbsource.o /adirectory/absource.o


what I want:
compiler <options> /adirectory/aasource.c
compiler <options> /adirectory/absource.c
compiler <options> /adirectory/acsource.c
compiler <options> /bdirectory/basource.c
compiler <options> /bdirectory/bbsource.c
compiler <options> /cdirectory/casource.c

linker <options> /adirectory/aasource.o /adirectory/absource.o /adirectory/acsource.o /bdirectory/basource.o /bdirectory/bbsource.o /cdirectory/casource.o
Re: How to process files in alphabetical order. [message #1015938 is a reply to message #1015593] Mon, 04 March 2013 10:38 Go to previous message
Tamas Csabina is currently offline Tamas CsabinaFriend
Messages: 28
Registered: November 2012
Junior Member
A figured it out:
As I am using my own custom toolchain, I only had to define my own commandLineGenerator for my linker tool to make this work. And in that class I was able to sort the input elements for the linker.


I had to define 2 new classes for my toolchain:
LinkerCommandLineGenerator, which implements IManagedCommandLineGenerator. This is the one that is defined under the commandLineGenerator option of the linker tool.
LinkerCommandLineInfo, which implements IManagedCommandLineInfo and used by the first one.


For users with MinGW toolchain:
I filled a bug, you could check that for updates:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=402108


Hope this helps someone.
Previous Topic:{ and }
Next Topic:How to setup Eclipse on Windows 7 for OpenCl
Goto Forum:
  


Current Time: Tue Apr 23 09:46:53 GMT 2024

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

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

Back to the top