---
# System prepended metadata

title: 'GCC: library is linked but reference is undefined'
tags: [g++, gcc, linker]

---

# GCC: library is linked but reference is undefined

`Linker command line is order-dependant. Only the symbols had used in the left side of the library will be defined.`
`See`
`"man GCC"`
`for more information`

## Example:
### Error
```SHELL
g++ $(shell wx-config --libs) -lwx_gtk3u_richtext-3.1 -lwx_baseu_xml-3.1 ...
```

### Correct
```SHELL
g++ -lwx_gtk3u_richtext-3.1 -lwx_baseu_xml-3.1 $(shell wx-config --libs) ...
```

###### tags: `gcc` `g++` `linker`