EClipse CDT/Juno and linker options --start-group

半世苍凉 提交于 2020-01-23 08:08:22

问题


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:

  1. Click in the option GCC C/C++ Linker
  2. 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.

  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!