cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE cannot find symbols or variables

Duy Tran
Associate II

Hello ST Community,

I am having the following issue with STM32CubeIDE. I am using the NUCLEO-STM32F767ZI kit and the STM32CubeMX to generate the CubeIDE project. My project uses lwip, mbedtls and GCP. I migrate the GCP from the X-CUBE-GCP: https://www.st.com/en/embedded-software/x-cube-gcp.html

When I just run the lwip and mbedtls, I can compile the code and everything runs. When I add the GCP in, the project cannot be compiled because the lwip cannot find some types like nfds_t, socklen_t... although the files can see their included files and I can still use the Open Declaration function. I already added all the include paths. Do you have any ideas what is going on with my STM32CubeIDE? I am using the latest version. Please see part of the build log:

../Middlewares/Third_Party/LwIP/src/include/lwip/priv/sockets_priv.h:164:3: error: unknown type name 'nfds_t'
   nfds_t poll_nfds;
   ^~~~~~
In file included from ../Middlewares/Third_Party/LwIP/src/core/memp.c:72:0:
../Middlewares/Third_Party/LwIP/src/include/lwip/netdb.h:108:5: error: unknown type name 'socklen_t'
     socklen_t         ai_addrlen;    /* Length of socket address. */
     ^~~~~~~~~
In file included from ../Middlewares/Third_Party/LwIP/src/include/lwip/def.h:52:0,
                 from ../Middlewares/Third_Party/LwIP/src/include/lwip/ip_addr.h:41,
                 from ../Middlewares/ST/STM32_Network_Library/Includes/net_address.h:35,
                 from ../Middlewares/ST/STM32_Network_Library/Includes/net_connect.h:31,
                 from ../Core/Inc/main.h:45,
                 from ../LWIP/Target/lwipopts.h:25,
                 from ../Middlewares/Third_Party/LwIP/src/include/lwip/opt.h:51,
                 from ../Middlewares/Third_Party/LwIP/src/core/memp.c:46:
../Middlewares/Third_Party/LwIP/src/include/lwip/netdb.h:115:69: error: invalid application of 'sizeof' to incomplete type 'struct sockaddr_storage'
 #define NETDB_ELEM_SIZE           (sizeof(struct addrinfo) + sizeof(struct sockaddr_storage) + DNS_MAX_NAME_LENGTH + 1)
                                                                     ^
../Middlewares/Third_Party/LwIP/src/include/lwip/arch.h:287:40: note: in definition of macro 'LWIP_MEM_ALIGN_BUFFER'
 #define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1U))
                                        ^~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/memp.h:96:3: note: in expansion of macro 'LWIP_DECLARE_MEMORY_ALIGNED'
   LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))); \
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/priv/memp_priv.h:64:29: note: in expansion of macro 'LWIP_MEM_ALIGN_SIZE'
 #define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x))
                             ^~~~~~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/memp.h:96:84: note: in expansion of macro 'MEMP_ALIGN_SIZE'
   LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))); \
                                                                                    ^~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/core/memp.c:78:42: note: in expansion of macro 'LWIP_MEMPOOL_DECLARE'
 #define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc)
                                          ^~~~~~~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/priv/memp_std.h:106:1: note: in expansion of macro 'LWIP_MEMPOOL'
 LWIP_MEMPOOL(NETDB,          MEMP_NUM_NETDB,           NETDB_ELEM_SIZE,               "NETDB")
 ^~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/priv/memp_std.h:106:56: note: in expansion of macro 'NETDB_ELEM_SIZE'
 LWIP_MEMPOOL(NETDB,          MEMP_NUM_NETDB,           NETDB_ELEM_SIZE,               "NETDB")
                                                        ^~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/netdb.h:115:69: error: invalid application of 'sizeof' to incomplete type 'struct sockaddr_storage'
 #define NETDB_ELEM_SIZE           (sizeof(struct addrinfo) + sizeof(struct sockaddr_storage) + DNS_MAX_NAME_LENGTH + 1)
                                                                     ^
../Middlewares/Third_Party/LwIP/src/include/lwip/arch.h:279:38: note: in definition of macro 'LWIP_MEM_ALIGN_SIZE'
 #define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1U) & ~(MEM_ALIGNMENT-1U))
                                      ^~~~
../Middlewares/Third_Party/LwIP/src/core/memp.c:78:42: note: in expansion of macro 'LWIP_MEMPOOL_DECLARE'
 #define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEMPOOL_DECLARE(name,num,size,desc)
                                          ^~~~~~~~~~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/priv/memp_std.h:106:1: note: in expansion of macro 'LWIP_MEMPOOL'
 LWIP_MEMPOOL(NETDB,          MEMP_NUM_NETDB,           NETDB_ELEM_SIZE,               "NETDB")
 ^~~~~~~~~~~~
../Middlewares/Third_Party/LwIP/src/include/lwip/priv/memp_std.h:106:56: note: in expansion of macro 'NETDB_ELEM_SIZE'
 LWIP_MEMPOOL(NETDB,          MEMP_NUM_NETDB,           NETDB_ELEM_SIZE,               "NETDB")
                                                        ^~~~~~~~~~~~~~~
make: *** [Middlewares/Third_Party/LwIP/src/core/subdir.mk:93: Middlewares/Third_Party/LwIP/src/core/memp.o] Error 1
make: *** Waiting for unfinished jobs....
"make -j8 all" terminated with exit code 2. Build might be incomplete.
 
13:19:13 Build Failed. 6 errors, 0 warnings. (took 18s.283ms)

Thanks and best regards,

Duy Tran

2 REPLIES 2
TDK
Guru

Find the file where those symbols are included and ensure they are #included prior to being used. Solve the first error reported and it usually solves some or all of the following errors in cases like this.

Be aware that #pragma once or include guards may force a specific order they are included.

If you feel a post has answered your question, please click "Accept as Solution".

Hi @TDK​ ,

The files containing the symbols are already included. Actually I solved several errors and more of the same come :(