标签云

微信群

扫码加入我们

WeChat QR Code

I don't want the gcc linker to show the undefined symbols as linkage errors. I'm using gcc 4.2 on MAC OSX 10.6Of course I've looked online for a solution, but all the tries failed!How can I modify this command to get rid of the undefined symbols error?gcc -o Proj $(wildcard *.o);Thanks.Edit: I'm working on a research project where I need the code to be linkable & I don't care if it'll have runtime exceptions


What does the command have to do with the question? Also, how to you expect to get an executable binary out of this if the linking phase fails? ... there is a reason why it is an error and not a warning ;)

2019年04月22日14分39秒

This is one of my favourite questions of all time.

2019年04月22日14分39秒

there are options to suppress the linkage errors like in here sourceware.org/binutils/docs/ld/Options.html I'm working on a research project where I need the code to be linkable & I don't care if it'll have runtime exceptions

2019年04月22日14分39秒

It's not related to runtime errors.It can't run if there's functions that don't exist.For instance, what if main is the linker error?What makes you think you can ignore these linker errors?

2019年04月22日14分39秒

Pansy: Investigation into what?Have you considered that you are possibly asking the wrong question here?What are you trying to achieve with this?

2019年04月22日14分39秒

there are options to suppress the linkage errors like in here sourceware.org/binutils/docs/ld/Options.html I'm working on a research project where I need the code to be linkable & I don't care if it'll have runtime exceptions

2019年04月22日14分39秒

Pansy: I edited my response, but it's not what you are after.

2019年04月22日14分39秒

The linked documentation is for GNU ld and doesn't apply to OS X but GNU ld will in fact allow you to generate executables with unresolved symbols using --unresolved-symbols=ignore-all. Doing so "makes sense" in that it is well defined, but it is not a sensible thing to do. Why would a sane compiler allow this? It's not the compiler's job to pass judgment.

2019年04月22日14分39秒