You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/bin/ld: /tmp/ccKM74Fy.o: in function `main':
main2.cpp:(.text+0x5): undefined reference to `terminal_open'
/usr/bin/ld: main2.cpp:(.text+0x20): undefined reference to `terminal_refresh'
/usr/bin/ld: main2.cpp:(.text+0x25): undefined reference to `terminal_read'
/usr/bin/ld: main2.cpp:(.text+0x38): undefined reference to `terminal_close'
/usr/bin/ld: /tmp/ccKM74Fy.o: in function `terminal_print(int, int, char const*)':
main2.cpp:(.text._Z14terminal_printiiPKc[_Z14terminal_printiiPKc]+0x40): undefined reference to `terminal_print_ext8'
collect2: error: ld returned 1 exit status
I assumed these symbols would be contained in the file libBearLibTerminal.so, but apparently not.
I created the .so and .h by compiling this repository using cmake .; make
The text was updated successfully, but these errors were encountered:
First, the -L (uppercase) option specifies an additional path for library search, similar to -I. It is the -l (lowercase) that specifies the name (without prefixes or suffixes) of a library to link with.
Second, the linker is very particular about link order, you have to specify dependencies after objects using them. In this case, -lBearLibTerminal should go after main2.cpp.
In other words (assuming both .h/.so are in the current directory) your command should look like
Also note that by default Linux binaries do not search for dependencies besides themselves. So the compiled binary won't run failing to find the library it has just linked with a moment ago. Dependencies are supposed to go into system directories =/. To make things simpler, you can make it search the current directory by adding a few flags:
Simple example: http://foo.wyrd.name/en:bearlibterminal#documentation
I am currently attempting to compile this with
however I obtain some errors such as
I assumed these symbols would be contained in the file
libBearLibTerminal.so
, but apparently not.I created the .so and .h by compiling this repository using
cmake .; make
The text was updated successfully, but these errors were encountered: