ultra sound distance undefined

We are trying to get the echo time display in the simple ide terminal - This is what we keep getting for an error.

We are very new to this... hope this is a simple fix!

Thanks to anyone willing to help!

Project Directory: C:/Users/ajansen3/Documents/SimpleIDE/My Projects/

SimpleIDE Version 1.0.2
C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/
C:/Users/ajansen3/Documents/SimpleIDE/ Updated on: 2016-12-16

propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2408)
propeller-elf-gcc.exe -I . -L . -I C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/cmm/ -I C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -I C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Sensor/libping -L C:/Users/ajansen3/Documents/SimpleIDE/Learn/Simple Libraries/Sensor/libping/cmm/ -o cmm/echo.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 echo.c -lm -lsimpletools -lsimpletext -lsimplei2c -lping -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
echo.c: In function 'main':
echo.c:8:5: error: 'distance' undeclared (first use in this function)
echo.c:8:5: note: each undeclared identifier is reported only once for each function it appears in
Done. Build Failed!


  • twm47099twm47099 Posts: 846
    edited 2017-01-27 - 16:32:56
    Usually an "undeclared" error means that a declaration statement is needed either in the function where the variable (distance) is used, or before "main ()" if it globally used in a number of functions.

    The format of the statement would be:
    Int distance;
    if the variable is an integer.

    There could be another reason for the error, but that can't be diagnosed without seeing the program. Please post your program by copying and pasting it between code blocks. Example:
    "[ code]
    Your code goes here.
    [ /code]"

    Don't include the "" or the space after the [ before the "c" or "/"
    Hope this helps.
Sign In or Register to comment.