Mingw64 cannot link with glfw because gdi32 functions are missing - c

I'm trying to compile the following program in Main.c:
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
int main()
{
glfwInit();
return 0;
}
I compile it with:
gcc -m64 -c -g -I"libs/vulkan/include" -I"libs/GLFW/include" -std=c11 -MMD -MP -MF "bin/main.o.d" -o bin/main.o src/Main.c
and link it with:
gcc -m64 -o bin/vulkanfirsttest.exe bin/main.o -L"libs/vulkan/lib" -L"libs/GLFW/lib" -L"C:/msys64/mingw64/lib" -lvulkan-1 -lglfw3 -lgdiplus
It compiles successfully but when I try to link it, it spits out the following errors:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x8e): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xc8): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x123): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x263): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x88b): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0x9db): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdaa): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdb9): undefined reference to `__imp_GetDeviceGammaRamp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xdc2): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf37): undefined reference to `__imp_CreateDCW'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf46): undefined reference to `__imp_SetDeviceGammaRamp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_monitor.c.obj):(.text+0xf4f): undefined reference to `__imp_DeleteDC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x21a): undefined reference to `__imp_CreateDIBSection'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x253): undefined reference to `__imp_CreateBitmap'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x304): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x397): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x432): undefined reference to `__imp_CreateRectRgn'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(win32_window.c.obj):(.text+0x4ab): undefined reference to `__imp_DeleteObject'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x16a): undefined reference to `__imp_SwapBuffers'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x42d): undefined reference to `__imp_ChoosePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x43b): undefined reference to `__imp_SetPixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xc97): undefined reference to `__imp_DescribePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xe81): undefined reference to `__imp_DescribePixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0xe9b): undefined reference to `__imp_SetPixelFormat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: libs/GLFW/lib/libglfw3.a(wgl_context.c.obj):(.text+0x1498): undefined reference to `__imp_DescribePixelFormat'
I found a post that had a similar problem, and the answer was to also link gdi32, but there isn't a gdi32 package in mysys2. There is gdiplus (mingw64/mingw-w64-x86_64-libgdiplus 5.6.1-1), but as you can see that doesn't help.

Related

Identical .so shared libraries (with no symbols) are generated when compiling different C source files

At the institution I work for we have a User Exit made in Pro*C (SQL embedded in C language). We are having some troubles because identical shared libraries are generated when compiling different source files. These .so files have no symbols. Everything was working alright just a few days ago, but suddenly this trouble occurred. What can we do?
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libentorno.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libconexion.so
-rwxrwxr-x. 1 user_name user_name 27440 Dec 23 11:27 libmsg.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libgralib.so
-rwxrwxr-x. 1 user_name user_name 88968 Dec 23 11:27 libeval.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libifcp0160.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libifcp0150.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libobn_calculo.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libdvo.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libobn.so
-rwxrwxr-x. 1 user_name user_name 7680 Dec 23 11:27 libmasiva.so
-rwxrwxr-x. 1 user_name user_name 2404472 Dec 23 11:28 libtax.so
We also cannot compile separate binary executables:
$ make -f ~/build/tax.mk ejecutable EXE=pmca0010
Procesando .pc -> .c
/usr/lib/oracle/18.5/client64/bin/proc sqlcheck=semantics dbms=v8 userid=tax/manejoint#taxd release_cursor=no hold_cursor=yes maxopencursors=100 include=/usr/lib/oracle/18.5/client64/rdbms/public include=/home/user_name/user_exit/src/inc iname=/home/user_name/user_exit/src/pc/pmca0010.pc
Pro*C/C++: Release 18.0.0.0.0 - Production on Thu Dec 23 11:29:26 2021
Version 18.5.0.0.0
Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /usr/lib/oracle/18.5/client64/precomp/admin/pcscfg.cfg
Procesando .c -> .o
gcc -c -fPIC -g -I/usr/include/oracle/18.5/client64/ -I/usr/lib/oracle/18.5/client64/rdbms/public -I/home/user_name/user_exit/src/inc -o /home/user_name/user_exit/src/pc/pmca0010.o /home/user_name/user_exit/src/pc/pmca0010.c
Generando pmca0010...
gcc -L/usr/lib/oracle/18.5/client64/lib/ -L/home/user_name/user_exit/lib -lifcp0150 -lmsg -lifcp0160 -lobn -lgralib -ldvo -leval -lobn_calculo -lmasiva -lconexion -lclntsh -lcrypt -lrt \
-o /home/user_name/user_exit/src/pc/pmca0010 /home/user_name/user_exit/src/pc/pmca0010.o
/usr/bin/ld: warning: libentorno.so, needed by /home/user_name/user_exit/lib/libconexion.so, not found (try using -rpath or -rpath-link)
/home/user_name/user_exit/src/pc/pmca0010.o: In function `main':
/home/user_name/user_exit/src/pc/pmca0010.c:3942: undefined reference to `error_func'
/home/user_name/user_exit/src/pc/pmca0010.c:3944: undefined reference to `ParametrosOracle'
/home/user_name/user_exit/src/pc/pmca0010.c:3970: undefined reference to `f_utl_file'
/home/user_name/user_exit/src/pc/pmca0010.c:3974: undefined reference to `SetArchivoErr'
/home/user_name/user_exit/src/pc/pmca0010.c:3975: undefined reference to `SetArchivoLog'
/home/user_name/user_exit/src/pc/pmca0010.c:3976: undefined reference to `SetArchivoDebug'
/home/user_name/user_exit/src/pc/pmca0010.c:3981: undefined reference to `g_archivo_trace_uex'
/home/user_name/user_exit/src/pc/pmca0010.c:3987: undefined reference to `g_archivo_trace_uex'
/home/user_name/user_exit/src/pc/pmca0010.c:3995: undefined reference to `f_debug'
/home/user_name/user_exit/src/pc/pmca0010.c:4044: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4046: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4047: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4070: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4138: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4164: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4177: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4178: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4179: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4180: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4181: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.o:/home/user_name/user_exit/src/pc/pmca0010.c:4182: more undefined references to `DebugAArchivo' follow
/home/user_name/user_exit/src/pc/pmca0010.o: In function `main':
/home/user_name/user_exit/src/pc/pmca0010.c:4240: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4246: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4287: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4293: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4341: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4347: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4365: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4370: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.o: In function `get_usuario':
/home/user_name/user_exit/src/pc/pmca0010.c:4390: undefined reference to `LeerVariableEntorno'
/home/user_name/user_exit/src/pc/pmca0010.c:4399: undefined reference to `LeerVariableEntorno'
/home/user_name/user_exit/src/pc/pmca0010.o: In function `obn_generar_masiva_paralelo':
/home/user_name/user_exit/src/pc/pmca0010.c:4549: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4550: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4551: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4561: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4663: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4664: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4669: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4683: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4684: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4685: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4686: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.o:/home/user_name/user_exit/src/pc/pmca0010.c:4688: more undefined references to `DebugAArchivo' follow
/home/user_name/user_exit/src/pc/pmca0010.o: In function `obn_generar_masiva_paralelo':
/home/user_name/user_exit/src/pc/pmca0010.c:4771: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4772: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4780: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4781: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:4903: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:4919: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5138: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5148: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5252: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5267: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5270: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5372: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5379: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5382: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5391: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5451: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5463: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5464: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5493: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5562: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5578: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5580: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5680: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5687: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5694: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5698: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5699: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5710: undefined reference to `RecuperarCreditoMasiva'
/home/user_name/user_exit/src/pc/pmca0010.c:5716: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5723: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5729: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5746: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5757: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5758: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5759: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5760: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5762: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5763: undefined reference to `obn_srv_obligacion_masiva'
/home/user_name/user_exit/src/pc/pmca0010.c:5788: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5789: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5790: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5798: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5816: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5824: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5826: undefined reference to `grabar_error_masiva_objetos'
/home/user_name/user_exit/src/pc/pmca0010.c:5828: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5829: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5839: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5840: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5848: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5866: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5874: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5876: undefined reference to `grabar_error_masiva_objetos'
/home/user_name/user_exit/src/pc/pmca0010.c:5878: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5879: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5889: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5892: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5893: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.o:/home/user_name/user_exit/src/pc/pmca0010.c:5904: more undefined references to `DebugAArchivo' follow
/home/user_name/user_exit/src/pc/pmca0010.o: In function `obn_generar_masiva_paralelo':
/home/user_name/user_exit/src/pc/pmca0010.c:5923: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5932: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5934: undefined reference to `grabar_error_masiva_objetos'
/home/user_name/user_exit/src/pc/pmca0010.c:5936: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5950: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5969: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:5978: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5979: undefined reference to `grabar_error_masiva_objetos'
/home/user_name/user_exit/src/pc/pmca0010.c:5980: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:5994: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6038: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:6049: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6070: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:6085: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6142: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:6147: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6154: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6208: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:6284: undefined reference to `LogError'
/home/user_name/user_exit/src/pc/pmca0010.c:6289: undefined reference to `DebugAArchivo'
/home/user_name/user_exit/src/pc/pmca0010.c:6313: undefined reference to `LogError'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_PROPORCIONAL_BAJA'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2020B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_MONTO_EX'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2014'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AMAX_ADIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2001'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AMIN_ADIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2016B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_DEVENGADO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_APLICA_TOPE'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_CUOTA'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_PORCENTAJE_EX'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `PLAN_PAGO_CALCULAR'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2015'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2002'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_FIJO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `CALCULAR_ADICIONAL'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_ALICUOTA'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2018B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2019B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AMIN_ALIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2016'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_TRATAMIENTO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_VARIACION_PORCENTUAL'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_AUTOMOTOR_1999'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2017'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `INTERES_RESARCITORIO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2021B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2018'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_INTERES_SI_NO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AVMIN_ALIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2013B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AVMAX_ALIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_DIF_CENSO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AMAX_ALIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_IMPORTE_EX'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2017B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2019'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_FACTURADO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_AVALUO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2015B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2006'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_PROPORCIONAL'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_TIPO_SUJETO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AVMIN_ADIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_CANT_MULTAS'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2020'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AVMAX_ADIC'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_TIPO_EX'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_IMPUESTO_MIN'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2021'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `GET_CREDITO'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `SET_IME_AMAX_ALIC_RUR'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2014B'
/home/user_name/user_exit/lib/libeval.so: undefined reference to `IMPUESTO_INMUEBLE_2013'
collect2: error: ld returned 1 exit status
make: *** [ejecutable] Error 1
rm /home/user_name/user_exit/src/pc/pmca0010.c
The libraries produced by the compiler do not have symbols:
$ nm libgralib.so
0000000000201028 B __bss_start
0000000000201028 b completed.6355
w __cxa_finalize##GLIBC_2.2.5
0000000000000540 t deregister_tm_clones
00000000000005b0 t __do_global_dtors_aux
0000000000200dd0 t __do_global_dtors_aux_fini_array_entry
0000000000200de0 d __dso_handle
0000000000200de8 d _DYNAMIC
0000000000201028 D _edata
0000000000201030 B _end
0000000000000628 T _fini
00000000000005f0 t frame_dummy
0000000000200dc8 t __frame_dummy_init_array_entry
0000000000000638 r __FRAME_END__
0000000000201000 d _GLOBAL_OFFSET_TABLE_
w __gmon_start__
00000000000004f0 T _init
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
0000000000200dd8 d __JCR_END__
0000000000200dd8 d __JCR_LIST__
w _Jv_RegisterClasses
0000000000000570 t register_tm_clones
0000000000201028 d __TMC_END__
Thank you
PS: Some of the files generated are EXACTLY the same:
$ md5sum *.so | sort
3f3a8fba409013b23ff52a25ef1a292d libifcp0150.so
440c761aac25771468e384e71977a50c libentorno.so
440c761aac25771468e384e71977a50c libifcp0160.so
52b79262a71da8ed1559ce8f644f512d libobn.so
70be43604caa02b188e8f703e6edcf7e libdvo.so
70be43604caa02b188e8f703e6edcf7e libobn_calculo.so
8bfc42eb45a0cfd5cf8a5e62b73e99b2 libmasiva.so
9b4c31fe428a62af7d3334938a594977 libconexion.so
b3916ef1db33449a21a06c7f2d4f05cc libgralib.so
ce825bb91af0ea64d50e34fcd3188d43 libmsg.so
d8e31590af6725a7a866f671b9e13aaa libeval.so
e2780910964cf8287346e9f2495aff89 libtax.so
Also, when I try to compile a binary:
$ make -f ~/build/tax.mk ejecutable EXE=pmca0010
Procesando .pc -> .c
/usr/lib/oracle/18.5/client64/bin/proc sqlcheck=semantics dbms=v8 userid=tax/manejoint release_cursor=no hold_cursor=yes maxopencursors=100 include=/usr/lib/oracle/18.5/client64/rdbms/public include=../src/inc iname=../src/pc/pmca0010.pc
Pro*C/C++: Release 18.0.0.0.0 - Production on Mon Dec 27 12:00:16 2021
Version 18.5.0.0.0
Copyright (c) 1982, 2018, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /usr/lib/oracle/18.5/client64/precomp/admin/pcscfg.cfg
Procesando .c -> .o
gcc -c -fPIC -g -I/usr/include/oracle/18.5/client64/ -I/usr/lib/oracle/18.5/client64/rdbms/public -I../src/inc -o ../src/pc/pmca0010.o ../src/pc/pmca0010.c
Generando pmca0010...
gcc -L/usr/lib/oracle/18.5/client64/lib/ -L../lib -lifcp0150 -lmsg -lifcp0160 -lobn -lgralib -ldvo -leval -lobn_calculo -lmasiva -lconexion -lclntsh -lcrypt -lrt \
-o ../src/pc/pmca0010 ../src/pc/pmca0010.o
/usr/bin/ld: ../src/pc/pmca0010.o: undefined reference to symbol 'LeerVariableEntorno'
/app/tax/lib/libentorno.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [ejecutable] Error 1
rm ../src/pc/pmca0010.c
Everything was working alright just a few days ago, but suddenly this trouble occurred.
A guess: you've modified your ~/build/tax.mk makefile (or something it includes).
What can we do?
Use appropriate revision control system, so you know what's changed, why and when.
This command line:
gcc -L/usr/lib/oracle/18.5/client64/lib/ -L/home/user_name/user_exit/lib \
-lifcp0150 -lmsg -lifcp0160 -lobn -lgralib -ldvo -leval -lobn_calculo \
-lmasiva -lconexion -lclntsh -lcrypt -lrt \
-o /home/user_name/user_exit/src/pc/pmca0010 \
/home/user_name/user_exit/src/pc/pmca0010.o
is wrong. It should be:
gcc /home/user_name/user_exit/src/pc/pmca0010.o \
-L/... -L/... -lifcp0150 -lmsg -lifcp0160 ... \
To understand why libraries should follow object files on the command line, read this or this.

Trouble linking own application using ffmpeg/libav

I have a source, that I'd like to build and link against the libav library on Linux.
I followed the compilation guide of ffmpeg here: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Everything works.
I build the included examples like this: FFmpeg: building example C codes
It also works.
Now, I'd like to build my own little applications, where I try to learn about using libav. My current problem is, that by using the command line
gcc muxing.c -g -I ../../../ffmpeg_build/include/ -L ../../../ffmpeg_build/lib/ -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lm -lz -lpthread -lfdk-aac -lmp3lame -lx264 -lva -lX11
I get to this point:
muxing.c: In function ‘write_audio_frame’:
muxing.c:354:5: warning: ‘avcodec_encode_audio2’ is deprecated [-Wdeprecated-declarations]
ret = avcodec_encode_audio2(codecContext, &pkt, frame, &got_packet);
^~~
In file included from ../../../ffmpeg_build/include/libavformat/avformat.h:317:0,
from muxing.c:42:
../../../ffmpeg_build/include/libavcodec/avcodec.h:5418:5: note: declared here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
^~~~~~~~~~~~~~~~~~~~~
muxing.c: In function ‘write_video_frame’:
muxing.c:524:5: warning: ‘avcodec_encode_video2’ is deprecated [-Wdeprecated-declarations]
ret = avcodec_encode_video2(codecContext, &pkt, frame, &got_packet);
^~~
In file included from ../../../ffmpeg_build/include/libavformat/avformat.h:317:0,
from muxing.c:42:
../../../ffmpeg_build/include/libavcodec/avcodec.h:5457:5: note: declared here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: ../../../ffmpeg_build/lib//libx264.a(opencl-8.o): undefined reference to symbol 'dlclose##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Then I read, in order to overcome this linker error, I have to append -ldl to my command line, but then I get this:
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_flush':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:204: undefined reference to `opus_multistream_decoder_ctl'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:169: undefined reference to `opus_multistream_decode_float'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:165: undefined reference to `opus_multistream_decode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:174: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:145: undefined reference to `opus_multistream_decoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:101: undefined reference to `opus_multistream_decoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:105: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:111: undefined reference to `opus_multistream_decoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:113: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:126: undefined reference to `opus_multistream_decoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:129: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:487: undefined reference to `opus_multistream_encode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:483: undefined reference to `opus_multistream_encode_float'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:492: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:530: undefined reference to `opus_multistream_encoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:348: undefined reference to `opus_multistream_encoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:358: undefined reference to `opus_multistream_surround_encoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:365: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_configure_encoder':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:121: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:123: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:128: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:131: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:134: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:136: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:139: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:142: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:145: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:148: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:153: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:156: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:161: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:164: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:410: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:412: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:426: undefined reference to `opus_multistream_encoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:287: undefined reference to `vorbis_analysis_buffer'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:294: undefined reference to `vorbis_analysis_wrote'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:310: undefined reference to `vorbis_analysis_blockout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:311: undefined reference to `vorbis_analysis'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:313: undefined reference to `vorbis_bitrate_addblock'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:317: undefined reference to `vorbis_bitrate_flushpacket'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:302: undefined reference to `vorbis_analysis_wrote'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:180: undefined reference to `vorbis_analysis_wrote'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:182: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:183: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:184: undefined reference to `vorbis_info_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:203: undefined reference to `vorbis_info_init'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_setup':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:98: undefined reference to `vorbis_encode_setup_vbr'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:107: undefined reference to `vorbis_encode_setup_managed'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:114: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:121: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:127: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:160: undefined reference to `vorbis_encode_setup_init'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:208: undefined reference to `vorbis_analysis_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:214: undefined reference to `vorbis_block_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:220: undefined reference to `vorbis_comment_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:222: undefined reference to `vorbis_comment_add_tag'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:224: undefined reference to `vorbis_analysis_headerout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:257: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:161: undefined reference to `vpx_codec_decode'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:221: undefined reference to `vpx_codec_get_frame'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:162: undefined reference to `vpx_codec_error'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:163: undefined reference to `vpx_codec_error_detail'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:161: undefined reference to `vpx_codec_decode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:162: undefined reference to `vpx_codec_error'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:222: undefined reference to `vpx_codec_get_frame'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:201: undefined reference to `vpx_codec_vp9_dx_algo'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:201: undefined reference to `vpx_codec_vp8_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_free':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:269: undefined reference to `vpx_codec_destroy'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:271: undefined reference to `vpx_codec_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:53: undefined reference to `vpx_codec_version_str'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:54: undefined reference to `vpx_codec_build_config'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:56: undefined reference to `vpx_codec_dec_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:59: undefined reference to `vpx_codec_error'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vp8_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:278: undefined reference to `vpx_codec_vp8_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vp9_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:298: undefined reference to `vpx_codec_vp9_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_encode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1118: undefined reference to `vpx_codec_encode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1126: undefined reference to `vpx_codec_encode'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `queue_frames':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:979: undefined reference to `vpx_codec_get_cx_data'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:981: undefined reference to `vpx_codec_get_cx_data'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `log_encoder_error':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:164: undefined reference to `vpx_codec_error'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:165: undefined reference to `vpx_codec_error_detail'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `codecctl_int':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:298: undefined reference to `vpx_codec_control_'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:524: undefined reference to `vpx_codec_get_caps'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:527: undefined reference to `vpx_codec_version_str'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:528: undefined reference to `vpx_codec_build_config'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:533: undefined reference to `vpx_codec_enc_config_default'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:534: undefined reference to `vpx_codec_err_to_string'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:719: undefined reference to `vpx_codec_enc_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:727: undefined reference to `vpx_codec_enc_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:812: undefined reference to `vpx_img_wrap'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:820: undefined reference to `vpx_img_wrap'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vp8_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1279: undefined reference to `vpx_codec_vp8_cx'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vp9_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1309: undefined reference to `vpx_codec_vp9_cx'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `codecctl_intp':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:320: undefined reference to `vpx_codec_control_'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_free':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:344: undefined reference to `vpx_codec_destroy'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:346: undefined reference to `vpx_codec_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libx265.o): In function `libx265_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:84: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:86: undefined reference to `x265_api_get_173'
../../../ffmpeg_build/lib//libavcodec.a(libx265.o): In function `libx265_encode_init_csp':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:494: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:496: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:498: undefined reference to `x265_api_get_173'
../../../ffmpeg_build/lib//libavcodec.a(libvpx.o): In function `ff_vp9_init_static':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpx.c:73: undefined reference to `vpx_codec_vp9_cx'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpx.c:73: undefined reference to `vpx_codec_get_caps'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:191: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:192: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:193: undefined reference to `vorbis_info_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:194: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:169: undefined reference to `vorbis_synthesis'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:175: undefined reference to `vorbis_synthesis_pcmout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:179: undefined reference to `vorbis_synthesis_read'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:170: undefined reference to `vorbis_synthesis_blockin'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:48: undefined reference to `vorbis_info_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:49: undefined reference to `vorbis_comment_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:97: undefined reference to `vorbis_synthesis_headerin'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:191: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:192: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:193: undefined reference to `vorbis_info_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:194: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:109: undefined reference to `vorbis_synthesis_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:110: undefined reference to `vorbis_block_init'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1490: undefined reference to `vaGetDisplay'
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1514: undefined reference to `vaGetDisplayDRM'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_derive':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1561: undefined reference to `vaGetDisplayDRM'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_create':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vdpau.c:461: undefined reference to `vdp_device_create_x11'
collect2: error: ld returned 1 exit status
So, what can I do, to get it compiled and linked fully?

Can't compile mongoose after add -lpthread -lws2_32 -fopenmp -lwsock32 using MinGw

I using CLion to write my project,Windows 10 is my OS.
I use MinGw to compile the source code with CMAKE,
and following the wrong message
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mgr_init':
C:/Users/admin/Desktop/TB2/mongoose.c:2023: undefined reference to `WSAStartup#8'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mgr_free':
C:/Users/admin/Desktop/TB2/mongoose.c:2081: undefined reference to `closesocket#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2082: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_resolve2':
C:/Users/admin/Desktop/TB2/mongoose.c:2139: undefined reference to `gethostbyname#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_resolve':
C:/Users/admin/Desktop/TB2/mongoose.c:2151: undefined reference to `inet_ntoa#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_parse_address':
C:/Users/admin/Desktop/TB2/mongoose.c:2226: undefined reference to `htonl#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2227: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2238: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2246: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_do_connect':
C:/Users/admin/Desktop/TB2/mongoose.c:2565: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2565: undefined reference to `inet_ntoa#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_broadcast':
C:/Users/admin/Desktop/TB2/mongoose.c:2763: undefined reference to `send#16'
C:/Users/admin/Desktop/TB2/mongoose.c:2765: undefined reference to `recv#16'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_set_non_blocking_mode':
C:/Users/admin/Desktop/TB2/mongoose.c:2861: undefined reference to `ioctlsocket#12'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_is_error':
C:/Users/admin/Desktop/TB2/mongoose.c:2881: undefined reference to `WSAGetLastError#0'
C:/Users/admin/Desktop/TB2/mongoose.c:2882: undefined reference to `WSAGetLastError#0'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_if_connect_tcp':
C:/Users/admin/Desktop/TB2/mongoose.c:2890: undefined reference to `socket#12'
C:/Users/admin/Desktop/TB2/mongoose.c:2899: undefined reference to `connect#12'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_if_connect_udp':
C:/Users/admin/Desktop/TB2/mongoose.c:2905: undefined reference to `socket#12'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_if_destroy_conn':
C:/Users/admin/Desktop/TB2/mongoose.c:2950: undefined reference to `closesocket#4'
C:/Users/admin/Desktop/TB2/mongoose.c:2953: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_accept_conn':
C:/Users/admin/Desktop/TB2/mongoose.c:2970: undefined reference to `accept#12'
C:/Users/admin/Desktop/TB2/mongoose.c:2977: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_open_listening_socket':
C:/Users/admin/Desktop/TB2/mongoose.c:3001: undefined reference to `socket#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3006: undefined reference to `setsockopt#20'
C:/Users/admin/Desktop/TB2/mongoose.c:3024: undefined reference to `bind#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3025: undefined reference to `listen#8'
C:/Users/admin/Desktop/TB2/mongoose.c:3029: undefined reference to `getsockname#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3032: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_write_to_socket':
C:/Users/admin/Desktop/TB2/mongoose.c:3051: undefined reference to `sendto#24'
C:/Users/admin/Desktop/TB2/mongoose.c:3053: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3053: undefined reference to `inet_ntoa#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3082: undefined reference to `send#16'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_read_from_socket':
C:/Users/admin/Desktop/TB2/mongoose.c:3127: undefined reference to `recv#16'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_recvfrom':
C:/Users/admin/Desktop/TB2/mongoose.c:3149: undefined reference to `recvfrom#24'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_handle_udp_read':
C:/Users/admin/Desktop/TB2/mongoose.c:3162: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3162: undefined reference to `inet_ntoa#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mgr_handle_conn':
C:/Users/admin/Desktop/TB2/mongoose.c:3227: undefined reference to `getsockopt#20'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mgr_handle_ctl_sock':
C:/Users/admin/Desktop/TB2/mongoose.c:3287: undefined reference to `recv#16'
C:/Users/admin/Desktop/TB2/mongoose.c:3289: undefined reference to `send#16'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mgr_poll':
C:/Users/admin/Desktop/TB2/mongoose.c:3547: undefined reference to `select#20'
C:/Users/admin/Desktop/TB2/mongoose.c:3553: undefined reference to `__WSAFDIsSet#8'
C:/Users/admin/Desktop/TB2/mongoose.c:3561: undefined reference to `__WSAFDIsSet#8'
C:/Users/admin/Desktop/TB2/mongoose.c:3562: undefined reference to `__WSAFDIsSet#8'
C:/Users/admin/Desktop/TB2/mongoose.c:3563: undefined reference to `__WSAFDIsSet#8'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_socketpair':
C:/Users/admin/Desktop/TB2/mongoose.c:3604: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3605: undefined reference to `htonl#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3607: undefined reference to `socket#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3608: undefined reference to `bind#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3609: undefined reference to `listen#8'
C:/Users/admin/Desktop/TB2/mongoose.c:3610: undefined reference to `getsockname#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3611: undefined reference to `socket#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3612: undefined reference to `connect#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3614: undefined reference to `getsockname#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3615: undefined reference to `connect#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3617: undefined reference to `accept#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3622: undefined reference to `closesocket#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3627: undefined reference to `closesocket#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3628: undefined reference to `closesocket#4'
C:/Users/admin/Desktop/TB2/mongoose.c:3629: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_sock_get_addr':
C:/Users/admin/Desktop/TB2/mongoose.c:3643: undefined reference to `getpeername#12'
C:/Users/admin/Desktop/TB2/mongoose.c:3645: undefined reference to `getsockname#12'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `deliver_websocket_data':
C:/Users/admin/Desktop/TB2/mongoose.c:4091: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:4094: undefined reference to `ntohl#4'
C:/Users/admin/Desktop/TB2/mongoose.c:4095: undefined reference to `ntohl#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_send_ws_header':
C:/Users/admin/Desktop/TB2/mongoose.c:4193: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:4200: undefined reference to `htonl#4'
C:/Users/admin/Desktop/TB2/mongoose.c:4202: undefined reference to `htonl#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `wait_until_ready':
C:/Users/admin/Desktop/TB2/mongoose.c:5806: undefined reference to `select#20'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `push_to_stdin':
C:/Users/admin/Desktop/TB2/mongoose.c:5815: undefined reference to `recv#16'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `pull_from_stdout':
C:/Users/admin/Desktop/TB2/mongoose.c:5837: undefined reference to `send#16'
C:/Users/admin/Desktop/TB2/mongoose.c:5844: undefined reference to `shutdown#8'
C:/Users/admin/Desktop/TB2/mongoose.c:5845: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `start_process':
C:/Users/admin/Desktop/TB2/mongoose.c:5931: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `handle_cgi':
C:/Users/admin/Desktop/TB2/mongoose.c:6241: undefined reference to `closesocket#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_send_http_file':
C:/Users/admin/Desktop/TB2/mongoose.c:6333: undefined reference to `ntohl#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_sock_addr_to_str':
C:/Users/admin/Desktop/TB2/mongoose.c:6725: undefined reference to `inet_ntoa#4'
C:/Users/admin/Desktop/TB2/mongoose.c:6731: undefined reference to `ntohs#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `parse_mqtt':
C:/Users/admin/Desktop/TB2/mongoose.c:7137: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7141: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7148: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7157: undefined reference to `ntohs#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_send_mqtt_handshake_opt':
C:/Users/admin/Desktop/TB2/mongoose.c:7225: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7228: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mqtt_publish':
C:/Users/admin/Desktop/TB2/mongoose.c:7261: undefined reference to `htons#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7262: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_mqtt_subscribe':
C:/Users/admin/Desktop/TB2/mongoose.c:7280: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj):C:/Users/admin/Desktop/TB2/mongoose.c:7285: more undefined references to `htons#4' follow
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_dns_encode_record':
C:/Users/admin/Desktop/TB2/mongoose.c:7699: undefined reference to `htonl#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7714: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_send_dns_query':
C:/Users/admin/Desktop/TB2/mongoose.c:7751: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_parse_dns':
C:/Users/admin/Desktop/TB2/mongoose.c:7823: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7824: undefined reference to `ntohs#4'
C:/Users/admin/Desktop/TB2/mongoose.c:7825: undefined reference to `ntohs#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `dns_handler':
C:/Users/admin/Desktop/TB2/mongoose.c:7906: undefined reference to `htons#4'
CMakeFiles\TB2.dir/objects.a(mongoose.c.obj): In function `mg_resolve_from_hosts_file':
C:/Users/admin/Desktop/TB2/mongoose.c:8132: undefined reference to `htonl#4'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\TB2.dir\build.make:225: recipe for target 'TB2.exe' failed
mingw32-make.exe[2]: *** [TB2.exe] Error 1
mingw32-make.exe[1]: *** [CMakeFiles/TB2.dir/all] Error 2
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/TB2.dir/all' failed
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
and my Cmake write like this
cmake_minimum_required(VERSION 3.3)
project(TB2)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
set(CMAKE_C_FLAGS "-std=c99 -static-libgcc -w -lpthread -lws2_32 -fopenmp -lwsock32")
set(SOURCE_FILES main.c r2nat_to_local.h mongoose.c mongoose.h sqlite3.c sqlite3.h TUtility.c TUtility.h cJSON.c cJSON.h url_parser.c url_parser.h)
add_executable(TB2 ${SOURCE_FILES})
target_link_libraries(TB2 sqlite3)
add_definitions(-DUNICODE -D_UNICODE -DMG_ENABLE_THREADS -DDEBUG -DDEBUG -DHAVE_MD5 -DRA100)
I don't know where is worng. After I add -lws2_32 -fopenmp -lwsock32
How to fix the error?

C "undefined reference to" error while compiling COSEG from RepeatMasker developers

I'm trying to compile COSEG, a program from the RepeatMasker developers (link: http://www.repeatmasker.org/COSEGDownload.html) on Xubuntu.
After unpacking the distribution I enter the directory and try to run make in my terminal but I get many "undefined reference to" errors:
massimiliano#compaq2:~/Programs/coseg$ make
cc -O4 -lm version.o coseg.o -o coseg
coseg.o: In function `compute_siegel_tri_pvalue.part.0':
coseg.c:(.text+0xa1): undefined reference to `log'
coseg.c:(.text+0xae): undefined reference to `exp'
coseg.c:(.text+0x47b): undefined reference to `log'
coseg.c:(.text+0x4c2): undefined reference to `exp'
coseg.c:(.text+0x4d7): undefined reference to `log'
coseg.c:(.text+0x683): undefined reference to `log'
coseg.c:(.text+0x6d7): undefined reference to `exp'
coseg.c:(.text+0x6e4): undefined reference to `log'
coseg.c:(.text+0x70f): undefined reference to `sqrt'
coseg.c:(.text+0x72d): undefined reference to `sqrt'
coseg.c:(.text+0x757): undefined reference to `sqrt'
coseg.o: In function `compute_siegel_pvalue.part.1':
coseg.c:(.text+0x7da): undefined reference to `log'
coseg.c:(.text+0x7e7): undefined reference to `exp'
coseg.c:(.text+0x97f): undefined reference to `exp'
coseg.c:(.text+0x98c): undefined reference to `log'
coseg.c:(.text+0x9ff): undefined reference to `log'
coseg.c:(.text+0xad7): undefined reference to `exp'
coseg.c:(.text+0xae4): undefined reference to `log'
coseg.c:(.text+0xb4d): undefined reference to `log'
coseg.c:(.text+0xbe7): undefined reference to `sqrt'
coseg.c:(.text+0xc05): undefined reference to `sqrt'
coseg.o: In function `compute_pvalue.part.2':
coseg.c:(.text+0xd3b): undefined reference to `log'
coseg.c:(.text+0xd4c): undefined reference to `log'
coseg.c:(.text+0xe24): undefined reference to `exp'
coseg.c:(.text+0xe86): undefined reference to `log'
coseg.c:(.text+0xe97): undefined reference to `log'
coseg.o: In function `compute_tri_pvalue.part.3':
coseg.c:(.text+0x10e4): undefined reference to `exp'
coseg.o: In function `inverseNormalCDF':
coseg.c:(.text+0x141e): undefined reference to `log'
coseg.c:(.text+0x150f): undefined reference to `sqrt'
coseg.o: In function `allocate_memory':
coseg.c:(.text+0x15de): undefined reference to `log'
coseg.c:(.text+0x166c): undefined reference to `log'
coseg.c:(.text+0x16cc): undefined reference to `log'
coseg.o: In function `compute_tri_pvalue':
coseg.c:(.text+0x303a): undefined reference to `log'
coseg.c:(.text+0x3047): undefined reference to `exp'
coseg.o: In function `compute_pvalue':
coseg.c:(.text+0x31e6): undefined reference to `log'
coseg.c:(.text+0x31f3): undefined reference to `exp'
coseg.o: In function `compute_score':
coseg.c:(.text+0x32cd): undefined reference to `log'
coseg.c:(.text+0x32da): undefined reference to `exp'
coseg.o: In function `compute_tri_score':
coseg.c:(.text+0x3386): undefined reference to `log'
coseg.c:(.text+0x3393): undefined reference to `exp'
coseg.o: In function `compute_tri_bestmut':
coseg.c:(.text+0x628c): undefined reference to `log'
coseg.c:(.text+0x629b): undefined reference to `exp'
coseg.o: In function `split_pvaluelocal':
coseg.c:(.text+0x6e55): undefined reference to `log'
coseg.c:(.text+0x734d): undefined reference to `log'
coseg.c:(.text+0x735a): undefined reference to `exp'
coseg.o: In function `compute_bestmut':
coseg.c:(.text+0x7ff3): undefined reference to `log'
coseg.c:(.text+0x8000): undefined reference to `exp'
coseg.o: In function `union_tri_pvalue':
coseg.c:(.text+0x91fd): undefined reference to `log'
coseg.c:(.text+0x920a): undefined reference to `exp'
coseg.c:(.text+0x934e): undefined reference to `log'
coseg.c:(.text+0x935b): undefined reference to `exp'
coseg.o: In function `union_pvalue':
coseg.c:(.text+0x9e1c): undefined reference to `log'
coseg.c:(.text+0x9e29): undefined reference to `exp'
coseg.o: In function `build_MST':
coseg.c:(.text+0xb232): undefined reference to `exp'
coseg.o: In function `compute_sigma':
coseg.c:(.text+0xb7d4): undefined reference to `log'
coseg.c:(.text+0xb7e1): undefined reference to `exp'
coseg.o: In function `compute_bestmut1':
coseg.c:(.text+0xbb27): undefined reference to `log'
coseg.c:(.text+0xbb34): undefined reference to `exp'
coseg.o: In function `build_new_subfamily2':
coseg.c:(.text+0xd265): undefined reference to `exp'
coseg.c:(.text+0xd2a6): undefined reference to `log'
coseg.c:(.text+0xd4ad): undefined reference to `exp'
coseg.c:(.text+0xd4ee): undefined reference to `log'
coseg.o: In function `sigmage_to_logpvalue':
coseg.c:(.text+0xd8a8): undefined reference to `exp'
coseg.c:(.text+0xd8ec): undefined reference to `log'
coseg.o: In function `build_new_singlemut_subfamily':
coseg.c:(.text+0xdb4d): undefined reference to `exp'
coseg.c:(.text+0xdb8e): undefined reference to `log'
coseg.c:(.text+0xdd7d): undefined reference to `exp'
coseg.c:(.text+0xddbe): undefined reference to `log'
coseg.o: In function `build_singlemut_MST':
coseg.c:(.text+0xe608): undefined reference to `log'
coseg.c:(.text+0xe615): undefined reference to `exp'
coseg.c:(.text+0xe8ce): undefined reference to `log'
coseg.c:(.text+0xe8db): undefined reference to `exp'
coseg.o: In function `build_MST2':
coseg.c:(.text+0xf38f): undefined reference to `exp'
coseg.c:(.text+0xf5d0): undefined reference to `exp'
coseg.c:(.text+0xf7c9): undefined reference to `exp'
coseg.c:(.text+0xf814): undefined reference to `log'
coseg.c:(.text+0xf85f): undefined reference to `exp'
coseg.c:(.text+0xfb3c): undefined reference to `exp'
coseg.c:(.text+0xfb97): undefined reference to `log'
coseg.c:(.text+0xfbf6): undefined reference to `exp'
coseg.c:(.text+0xfcd8): undefined reference to `sqrt'
coseg.c:(.text+0xfd51): undefined reference to `sqrt'
coseg.o: In function `print_subfamilies':
coseg.c:(.text+0xffe0): undefined reference to `exp'
coseg.c:(.text+0x10024): undefined reference to `log'
collect2: ld returned 1 exit status
make: *** [coseg] Error 1
Searching the internet I have found that probably it is a 'linking' problem and I have to add/modify some lines of code in the makefile but this kind of stuffs are very new to me and I am not a programmer, so I feel a bit confused.
Do you have some tips or suggestions to help me to solve this problem, please?
Thank you very much for your time!
Massimiliano.
Update:
Trying to compile the previous version of the program, gives me an additional warning:
echo "char const* Version = \"0.2.1\";" > version.c
cc -O4 -lm -c -o version.o version.c
cc -O4 -lm -c -o coseg.o coseg.c
coseg.c: In function ‘inverseNormalCDF’:
coseg.c:973:5: warning: format ‘%lf’ expects a matching ‘double’ argument [-Wformat]
Update - Makefile:
This is the Makefile unpacked with the distribution:
##
## Makefile for coseg project
##
VERSION=0.2.2
INSTALLDIR=/usr/local/coseg-${VERSION}
## Basic
CC = cc -O4 -lm
## A nice memory leak checker:
#CC = bgcc -O4 -fbounds-checking -lm
all: coseg
version.c: Makefile
echo "char const* Version = \"$(VERSION)\";" > version.c
coseg: version.o coseg.o
${CC} version.o coseg.o -o coseg
beautify:
indent -bap -cdb -bl -bli0 -npcs -nut -lp coseg.c
install: coseg
-mkdir ${INSTALLDIR}
cp coseg ${INSTALLDIR}
cp README ${INSTALLDIR}
cp preprocessAlignments.pl ${INSTALLDIR}
cp postprocess.pl ${INSTALLDIR}
cp runcoseg.pl ${INSTALLDIR}
cp extractSubSeqs.pl ${INSTALLDIR}
cp refineConsSeqs.pl ${INSTALLDIR}
cp ALU.cons ${INSTALLDIR}
cp ALU.ins ${INSTALLDIR}
cp ALU.seqs ${INSTALLDIR}
cp LINE1 ${INSTALLDIR}
dist:
-mkdir dist
-mkdir dist/coseg
cp ALU.cons dist/coseg
cp ALU.ins dist/coseg
cp ALU.seqs dist/coseg
cp LINE1 dist/coseg
cp Makefile dist/coseg
cp README dist/coseg
cp coseg.c dist/coseg
cp coseg.h dist/coseg
cp postprocess.pl dist/coseg
cp preprocessAlignments.pl dist/coseg
cp runcoseg.pl dist/coseg
cp extractSubSeqs.pl dist/coseg
cp refineConsSeqs.pl dist/coseg
(cd dist; tar zcvf coseg-$(VERSION).tar.gz coseg)
clean:
-rm *.o
-rm coseg
-rm version.c
-rm ALU.seqs.subfamilies.seq
-rm ALU.seqs.assign
-rm ALU.seqs.log
-rm ALU.seqs.subfamilies
-rm ALU.seqs.tree.viz
ALU.seqs.subfamilies.seq: coseg
./runcoseg.pl -d -filePrefix ALU
t/kothi.seqs.subfamilies.seq: coseg
./runcoseg.pl -u1 -t -m 5 -filePrefix t/kothi
test: ALU.seqs.subfamilies.seq t/kothi.seqs.subfamilies.seq
diff ALU.seqs.subfamilies.seq t
diff t/kothi.seqs.subfamilies.seq t/kothi-baseline
Some linkers (including yours) need to have the libraries specified after the object files (or other libraries), which use symbols from it. This can even lead to the necessity to specify libraries multiply if cyclic dependencies are involved.
In your case coseg.o uses symbols from libm, so you would have to specify -lm after coseg.o in your command: cc -O4 version.o coseg.o -lm -o coseg
I suggest you change your Makefile to:
##
## Makefile for coseg project
##
VERSION=0.2.2
INSTALLDIR=/usr/local/coseg-${VERSION}
## Basic
CC = cc
CFLAGS = -O4
LDFLAGS = -lm
## A nice memory leak checker:
#CC = bgcc -O4 -fbounds-checking -lm
all: coseg
version.c: Makefile
echo "char const* Version = \"$(VERSION)\";" > version.c
coseg: version.o coseg.o
${CC} version.o coseg.o ${LDFLAGS} -o coseg
... rest of makefile ...
That should fix your problem.

Arm sourcery toolchain linking error

I want to use standard c function in one of my function
void print(const char* format,...) {
char buffer[256];
va_list args;
va_start (args, format);
vsnprintf (buffer,256,format, args);
va_end (args);
sendString(buffer);
}
Error coming is
arm-none-eabi-ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o lowlevel.o main.o startup.o \
-L/usr/arm-none-eabi/lib -lc -lg -lm
/usr/arm-none-eabi/lib/libc.a(lib_a-svfprintf.o): In function `_svfprintf_r':
vfprintf.c:(.text+0x688): undefined reference to `__aeabi_dcmplt'
vfprintf.c:(.text+0xdfc): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x10b4): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x168c): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x16a8): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0x1a48): undefined reference to `__aeabi_dcmpeq'
vfprintf.c:(.text+0x1eac): undefined reference to `__aeabi_dcmpeq'
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `quorem':
dtoa.c:(.text+0x3c): undefined reference to `__aeabi_uidiv'
/usr/arm-none-eabi/lib/libc.a(lib_a-dtoa.o): In function `_dtoa_r':
dtoa.c:(.text+0x274): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x360): undefined reference to `__aeabi_ui2d'
dtoa.c:(.text+0x37c): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x388): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x394): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x3a4): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x3b0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x3c4): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x3d0): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x3e8): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x418): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0x5a8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0x5ac): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x5b4): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x5c0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x5d4): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x608): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x61c): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x650): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x664): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0x684): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0x688): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x690): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x69c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x6b0): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x6fc): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x718): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x73c): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0xa94): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xaa0): undefined reference to `__aeabi_dcmpeq'
dtoa.c:(.text+0xbf8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xc2c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xc58): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xc80): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xc90): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xc9c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xca8): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0xce8): undefined reference to `__aeabi_ddiv'
dtoa.c:(.text+0xcf4): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd08): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0xd10): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xd24): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd54): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xd78): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xd8c): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xdd0): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xddc): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xe00): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xe1c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xe28): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0xe30): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xe44): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xe64): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0xef0): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0xefc): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0xf08): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0xf24): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0xf38): undefined reference to `__aeabi_dcmpgt'
dtoa.c:(.text+0xf54): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x10c0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x10e8): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x1130): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x1144): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x114c): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x1160): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x119c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x11a8): undefined reference to `__aeabi_d2iz'
dtoa.c:(.text+0x11b0): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x11c8): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x1200): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x120c): undefined reference to `__aeabi_dcmplt'
dtoa.c:(.text+0x12cc): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x12d8): undefined reference to `__aeabi_dcmpge'
dtoa.c:(.text+0x158c): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x159c): undefined reference to `__aeabi_i2d'
dtoa.c:(.text+0x15b0): undefined reference to `__aeabi_dmul'
dtoa.c:(.text+0x15bc): undefined reference to `__aeabi_dadd'
dtoa.c:(.text+0x15ec): undefined reference to `__aeabi_dsub'
dtoa.c:(.text+0x15f8): undefined reference to `__aeabi_dcmpgt'
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `__ratio':
mprec.c:(.text+0xbc0): undefined reference to `__aeabi_ddiv'
/usr/arm-none-eabi/lib/libc.a(lib_a-mprec.o): In function `_mprec_log10':
mprec.c:(.text+0xbf0): undefined reference to `__aeabi_dmul'
/usr/arm-none-eabi/lib/libc.a(lib_a-svfiprintf.o): In function `_svfiprintf_r':
vfprintf.c:(.text+0xf30): undefined reference to `__aeabi_uldivmod'
vfprintf.c:(.text+0xf4c): undefined reference to `__aeabi_uldivmod'
make: *** [all] Error 1
*** Failure: Exit code 2 ***
My makefile is this
TOOLCHAIN=arm-none-eabi-
ARM_CPU=arm7tdmi
VPATH= /home/sanju/Arm/check/src /home/sanju/Arm/check/other /home/sanju/Arm/check/include
INCLUDE= /home/sanju/Arm/check/include
CCFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -ffunction-sections -Os -Wall
ASFLAGS= -mcpu=$(ARM_CPU) -mthumb-interwork -mfpu=softfpa -Wall
all: Serial.o irq.o lowlevel.o main.o startup.o
$(TOOLCHAIN)ld -o check.elf -T /home/sanju/Arm/check/other/ROM.ld Serial.o irq.o
lowlevel.o main.o startup.o \
-L/usr/arm-none-eabi/lib -lc -lg -lm
$(TOOLCHAIN)objcopy -O ihex check.elf check.hex
$(TOOLCHAIN)objcopy -O binary check.elf check.bin
Serial.o : Serial.c Serial.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
irq.o : irq.c irq.h lpc214x.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
lowlevel.o : lowlevel.c lowlevel.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
main.o : main.c lpc214x.h timer0.h Asm.h lowlevel.h type.h Serial.h
$(TOOLCHAIN)gcc $(CCFLAGS) -I$(INCLUDE) -c $<
startup.o : startup.S
$(TOOLCHAIN)as $(ASFLAGS) -o startup.o $<
.PHONY: clean
clean :
rm -rf *.o *.elf *.hex *.o *.bin
In the target all it fails in linking. I have tried the example with arm-elf toolchain there also i am getting some errors.I have googled a lot for it but did not find any solution for it.
Try using gcc as ld frontend.
Change:
$(TOOLCHAIN)ld -o check.elf [...]
into
$(TOOLCHAIN)gcc -o check.elf [...]
GCC knows to add some necessary options when invoking ld.
Do things go any better when adding "-lgcc" to -L?
instead of using ld for linking i used gcc but it was including the supplied crt.o object file so i used -nostartfiles and it worked for me.

Resources