0

I have a .o file lib.o that was already compiled and contains functions f and g.

I have a .cpp file main.cpp that uses functions f and g.

How do I properly use f and g in main.cpp and how do I compile main.cpp with lib.o?

I tried g++ main.cpp lib.o -o main -lirc

but I get the error:

main.cpp:(.text+0x18c): undefined reference to `f(unsigned short)'

main.cpp:(.text+0x1a8): undefined reference to `g(unsigned short)'
user352102
  • 199
  • 2
  • 9
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Mike Kinghan Sep 23 '18 at 18:48
  • 3
    The answer you need is probably [Symbols were defined in a C program and used in C++ code](https://stackoverflow.com/a/12574420/1362568) – Mike Kinghan Sep 23 '18 at 18:49

0 Answers0