We were unable to find the symbol ... There are several things that can hinder symbol lookup

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
JoBr_1593366
Level 5
Level 5
100 sign-ins 50 questions asked 100 replies posted

[I cannot reply to https://community.cypress.com/t5/PSoC-5-3-1-MCU/We-were-unable-to-find-the-symbol-There-are-several-... from the old forum so I will create it again]

 

Often when I right-click a function name and select Go To Definition, it doesn't work.  I get this error:

We were unable to find the symbol 'FunctionName. There are several things that can hinder symbol lookup:      

  • Make sure your project compiles without errors.      
  • Make sure your "Generated Source" has been generated (Build -> Generate Application).      
  • Make sure your .c files #include their corresponding header files.

The project compiles without errors, the Generated Source has been generated, and the .c files include the .h files which declare the function.

I don't understand why this works for some functions and not others.

I have to use Ctrl+Shift+F and search for the function definition manually.

Has anyone had this problem and figured it out?

 

For example, if I create a New Project, with the UART_Full_Duplex example, and build it, and then in main.c try to right-click on UART_PutString and Go To Definition, it produces this error.  Is it a missing .h file or something?

0 Likes
5 Replies
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

In my experience something similar to your question happened when

(1)  The function is not called and optimized out by the compiler

(2) The function was defined as inline or preprocessor macro

May be trying to build the program without any optimization will let you find the function.

 

I tried with PSoC Creator v4.4 for CY8CKIT-059.

I could not reproduce the problem.

The following was my test today. (but in vain, though)

Build Settings

001-Build_Settings_ARM_GCC_XX_Compiler_Optimization.JPG

Goto Definition

002-Goto_Defintion.JPG

UART.c

003-UART_c.JPG

moto

I tried building it in Debug mode to disable optimization, but it still doesn't work. 

JoBr_1593366_0-1624195158039.png

 

--------------- Build Succeeded: 06/20/2021 09:18:08 ---------------
We were unable to find the symbol. There are several things that can hinder symbol lookup:
- Make sure your project compiles without errors.
- Make sure your "Generated Source" has been generated (Build -> Generate Application).
- Make sure your .c files #include their corresponding header files.

Reproduction:

Environment:
PSoC Creator 4.4 (4.4.0.80)
Culture: English (United States)
OS Version: Microsoft Windows NT 10.0.19043.0
CLR Version: 4.0.30319.42000

  1. Create New Project
  2. Target device CY8C3446LTI-073
  3. Code example
  4. UART_Full_Duplex
  5. Create in default location C:\Users\USERNAME\Documents\PSoC Creator\
  6. Workspace and Project name UART_Full_Duplex_deleteme
  7. Debug mode
  8. Assign LED to pin 1, SW2 to pin 2
  9. Build Succeeded: Flash used: 5634 of 65536 bytes (8.6%). SRAM used: 154 of 8192 bytes (1.9%).
  10. Open main.c
  11. Scroll down to a function, like "LED_Write(LED_OFF); /* Clear LED */"
  12. Right-click, Go To Definition
  13. Gives the "unable to find the symbol" error.

 

On the other hand:

  1. Create New Project
  2. Target device CY8C3446LTI-073
  3. Code example
  4. USB_UART
  5. Create in default location C:\Users\USERNAME\Documents\PSoC Creator\
  6. Workspace and Project name USBFS_UART_deleteme
  7. Debug mode
  8. Set PLL_OUT to 49.8 MHz
  9. Assign LCD Port[0] to pin 34
  10. Build Succeeded: Flash used: 18131 of 65536 bytes (27.7%). SRAM used: 494 of 8192 bytes (6.0%).
  11. Open main.c
  12. Scroll down to a function, like "USBUART_CDC_Init();"
  13. Right-click, Go To Definition
  14. It works, showing the definition in USBUART_cdc.c

So why does one project work and the other doesn't?

 

I didn't see that you had posted an example project.  I downloaded that, built it, and it succeeded, and then I can right-click on a function and it goes to the definition.  I really don't understand why it works in your project but not mine.  Because the chip is different?  That's the only difference, right?

Oh your chip is PSoC5, that could make a difference.  CortexM3 with ARM_GCC_541 vs DP8051_Keil_951. Maybe there's something missing in the PSoC3 header files?

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

 Because the chip is different?  That's the only difference, right?

This can be the main reason.

For PSoC 4, 5LP, 6, GNU C is being used,.

But for PSoC 3, which uses 8051 (8bit) CPU core,

ARM MDK Keil is being used as the toolchain.

 

Anyway, So I tried with CY8C3446LTI-073 as device.

And, yes, I could reproduce your problem!

I have been tweaking for a few hours but have not found any cure, yet.

 

But one thing I noticed was if I select some register definition, such as

UART_RXSTATUS_REG

and chose "Go to definition",  PSoC Creator can locate the definition of the register definition in UART.h.

So the including/referencing must be working.

 

Then why we can not locate "UART_PutString()" ?

I'm sorry, but I don't have a good answer.

Hopefully someone from Infineon/Cypress (or from ARM) may have an answer.

 

By the way, I just added a function foo() in main.c something like

int foo(int a)
{
    return( a - 1) ;
}

And called it just before the first printf()

int main()
{
    uint8 button = 0u;
    uint8 buttonPre = 0u;
    
    LED_Write(LED_OFF);     /* Clear LED */

    UART_Start();           /* Start communication component */
    UART_PutString("UART Full Duplex and printf() support Code Example Project \r\n");

#if(INTERRUPT_CODE_ENABLED == ENABLED)
    isr_rx_StartEx(RxIsr);
#endif /* INTERRUPT_CODE_ENABLED == ENABLED */
    
    CyGlobalIntEnable;      /* Enable global interrupts. */
    
#if(UART_PRINTF_ENABLED == ENABLED)
{
    uint32 i = 444444444u;
    float f = 55.55555f;
    
    i = foo(i) ;

And I selected foo and tried "Go To Definition" and got the same error.

Even in the same source file, "Go To Definition" does not find the function!

I would rather call this a bug, if I may.

 

moto

 

 

 

Thank you for trying to find the cause.  This has been bothering me for years. 

Now I'm getting Inline Diagnostics errors for "use of undefined identifier" even though the project builds fine.

JoBr_1593366_0-1624290720044.png

JoBr_1593366_1-1624290777769.png

I combined the USBFS_UART and UART_Full_Duplex examples to make a USB-UART bridge, and now "Go To Definition" works for the USBUART_… functions, but not for the UART_… functions, even in the same main.c file.

So maybe this is an issue with the component itself?  Since the problem carried over even when copying the code from one project to another, and only applies to functions associated with one component and not the other.

0 Likes

It can't even find the definition of a function that's defined in the same file!

0 Likes