Indeed as Simon Richter stated, --whole-archive
option can be useful. Try to change your command-line to:
gcc -o main main.o util.o -L ./libs -Wl,--whole-archive -lfooutils -Wl,--no-whole-archive
and you’ll see a multiple definition error.
More Related Contents:
- Removing trailing newline character from fgets() input
- Modulo operation with negative numbers
- C undefined behavior. Strict aliasing rule, or incorrect alignment? [duplicate]
- Order of local variable allocation on the stack
- What is the meaning of lines starting with a hash sign and number like ‘# 1 “a.c”‘ in the gcc preprocessor output?
- Undefined reference to `pow’ and `floor’
- Adding leading underscores to assembly symbols with GCC on Win32?
- What is the difference between C, C99, ANSI C and GNU C?
- aligned malloc() in GCC?
- Why didn’t gcc (or glibc) implement _s functions?
- How to access C variable for inline assembly manipulation?
- GCC fatal error: stdio.h: No such file or directory
- How to check if a given file descriptor stored in a variable is still valid?
- Why doesn’t GCC optimize structs?
- Detecting 64bit compile in C
- How to make gcc link strong symbol in static library to overwrite weak symbol?
- C preprocessor: expand macro in a #warning
- multi-word addition using the carry flag
- Inline assembly that clobbers the red zone
- Why “initializer element is not a constant” is… not working anymore?
- GCC 4.7 Source Character Encoding and Execution Character Encoding For String Literals?
- Tool to analyze size of ELF sections and symbol
- Process Linkage Table and Global Offset Table
- Why both clang and gcc only give a warning when there is a space after backslash if C standard says that whitespace is forbidden?
- Compiler changes printf to puts
- How to add multiple header include and library directories to the search path in a single gcc command?
- How does GCC behave if passed conflicting compiler flags?
- why am I not getting an “used uninitialized” warning from gcc in this trivial example? [duplicate]
- & operator optional in function pointer assignment
- How do I compile the asm generated by GCC?