Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE compile errors — Parallax Forums

SimpleIDE compile errors

Two of my students are working with an ActivityBot, programming it in C with SimpleIDE. They are getting several compile errors that I can't resolve. Any help is much appreciated!
Their code for trying to test the servos is:

#include "simpletools.h"
#include "abdrive.h"

int main()
{

while(1)
{
drive_trimSet(0, 0, 0);
drive_speed(60, 60);
//pause(8000);
//drive_speed(0, 0);
}
}

The compile errors are as follows:

Project Directory: /Users/computer_science_2/Documents/SimpleIDE/

SimpleIDE Version 1.1.0
/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/
/Users/computer_science_2/Documents/SimpleIDE/ Updated on: 2018-02-14

propeller-elf-gcc -v GCC 4.6.1 (propellergcc_v1_0_0-36-g4c46ecb)
propeller-elf-gcc -I . -L . -I /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/cmm/ -I /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -I /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive -L /Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/cmm/ -o cmm/brad.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 brad.c -lm -lsimpletools -lsimpletext -lsimplei2c -labdrive -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm

In file included from brad.c:6:0:

/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/abdrive.h: In function 'main':
/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/abdrive.h:3:3: warning: implicit declaration of function 'servo_angle' [-Wimplicit-function-declaration]
/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/abdrive.h:7:3: warning: implicit declaration of function 'servo_setramp' [-Wimplicit-function-declaration]

brad.c: At top level:
brad.c:7:5: error: redefinition of 'main'
/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/abdrive.h:1:5: note: previous definition of 'main' was here

brad.c: In function 'main':
brad.c:15:3: warning: implicit declaration of function 'drive_trimSet' [-Wimplicit-function-declaration]
brad.c:16:3: warning: implicit declaration of function 'drive_speed' [-Wimplicit-function-declaration]

Done. Build Failed!

Comments

  • It would seem your libabdrive library is corrupted because the functions are not being defined and there is a definition for "main" in abdrive.h which should not be there.

    Mike
  • Firstly, you can include code in a better format for reading, using the 'C' icon in the posting editor (see below)... Since we can't see your actual project setup, it's difficult to debug why this code does not compile on your system (it compiles on my system, with just the warnings, no errors). I've attached a ZIP of the project as it builds on my system. If that project does not successfully compile on your system, your installation of SimpleIDE and its libraries may be corrupted.
    #include "simpletools.h"
    #include "abdrive.h"
    
    int main()
    {
    
      while(1)
      {
        drive_trimSet(0, 0, 0);
        drive_speed(60, 60);
        //pause(8000);
        //drive_speed(0, 0);
      }
    }
    

    BTW: The only error that causes the failure on your system is "brad.c:7:5: error: redefinition of 'main'". The other results are warnings, that are important but would not have caused a compile failure...

    The error is stating that 'main' was already defined in the library file "/Users/computer_science_2/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/abdrive.h". Did someone edit that library file, by mistake? There should be no definition of 'main' in that file!

    dgately
  • It looks like you are using an earlier version of the library since the newer versions don't have the trim functions.

    If I were to guess, someone accidentally saved a c file with main() to the library.

    Tom
  • Thank you, everyone, for your help!
Sign In or Register to comment.