问题
I know the -l and -L options for link but I am looking to set the --start-group and --end-group and all my libraries into my C project (Properties) under CDT/Juno but where do I put this option ???? -Xlinker ?
Thanks Marc
回答1:
You can insert this options through "Expert settings: Command line patterns".
To insert the options -Wl,--start-group
and -Wl,--end-group
you can edit this field. Follow the steps below:
- Click in the option GCC C/C++ Linker
- Edit the field Command line pattern
from
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
to
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} $(OBJS) -Wl,--start-group $(USER_OBJS) -Wl,--end-group $(LIBS)
Notice that we are open the variable ${INPUTS}
that's equal INPUT="$(OBJS) $(USER_OBJS) $(LIBS)"
. Check the result in the makefile generated.
- Insert your static files in the section GCC C/C++ Linker -> Miscellaneous -> Other objects.
回答2:
I ran into this same issue - a quick workaround I used was to make the first entry in my toolchain linker "other objects" list the value "-Wl,--start-group" and the last entry "-Wl,--end-group".
来源:https://stackoverflow.com/questions/15321992/eclipse-cdt-juno-and-linker-options-start-group