Shop OBEX P1 Docs P2 Docs Learn Events
Printi() not working? — Parallax Forums

Printi() not working?

SapphireSapphire Posts: 496
edited 2014-09-14 10:33 in Propeller 1
I tried using printi() in a program and I get a build error: undefined reference to `_printi'

So I wrote this program using SimpleIDE to test it. I included the simpletext.h file, but still get the error. What am I missing?
/*   Blank Simple Project.c
   http://learn.parallax.com/propeller-c-tutorials 
*/
#include "simpletools.h"                      // Include simple tools
#include "simpletext.h"                       // Include simple text
 
int main()                                    // Main function
{
  
  print("Print test: %d\n",1);                // this works
   
  printi("Printi test: %d\n",2);              // THIS DOESN'T WORK!
  
}

Comments

  • jazzedjazzed Posts: 11,803
    edited 2014-09-14 07:14
    Your learn folder is probably out of date. Get the updated one here.
  • SapphireSapphire Posts: 496
    edited 2014-09-14 08:52
    Jazzed,

    I had updated my learn folder this week to the 8-27-14 version (and just did it again now) but still get the same error. The SimpleIDE version is 0.9.64.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-14 09:28
    The "second most likely cause" of this problem is having a old Simple Libraries folders within the current project folder or the Documents/SimpleIDE folder.

    Do you have any "library" folders in your project folder? If so move them to another folder or remove them entirely. Presumably they would only appear because they were zipped in the first place.

    There have been different versions of Simple Libraries with different functions, and the Zip feature tries to put the libraries used at Zip time in the Zip for being able to recompile the program at some later time. The problem with this approach which I begged to not implement is that old libraries can end up in bad places. This issue comes up again, and again.

    The library rule is that if a project folder contains a library set, that folder will be searched first. If there are no library folders, then the SimpleIDE program will search SimpleIDE/Simple Libraries/Learn folder.

    The "third most likely cause" of the problem is in having "Auto Include Simple Libraries" unchecked. Please ensure that "Auto Include Simple Libraries" is checked in the Properties -> General tab (this setting is sticky in one SimpleIDE version, but by design it should never be or have been sticky). There are times where we don't want this to be selected, but those times are rare and can cause more trouble for the target audience. The same goes for many other decisions made in SimpleIDE behavior for the Learn program.
  • SapphireSapphire Posts: 496
    edited 2014-09-14 10:15
    Jazzed,

    Thanks for your reply. The check box to Auto Include Simple Libraries is checked. The Projects check box is not checked.

    I'm not sure where to look for the duplicate libraries in my projects, but I did find this: there are two Text Devices folders in the \Documents\SimpleIDE\Learn\Simple Libraries folder, one called "Text Devices" and one called "TextDevices" (without a space). The latter is much older. Is this the library I should remove?

    In case this helps, here is the build error log:
    Project Directory: C:/Users/sapphire/Documents/SimpleIDE/My Projects/
    SimpleIDE Version 0.9.64
    C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/
    C:/Users/sapphire/Documents/SimpleIDE/ Updated on: 2014-09-14
    propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2408)
    propeller-elf-gcc.exe -I . -L . -I C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/sapphire/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/Printi_test.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 Printi_test.c -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
    Printi_test.c: In function 'main':
    Printi_test.c:13:3: warning: implicit declaration of function 'printi' [-Wimplicit-function-declaration]
    C
    :\Users\sapphire\AppData\Local\Temp\ccnNfhpn.o: In function `_main':
    (.text+0x1a): undefined reference to `_printi'
    collect2: ld returned 1 exit status
    Done. Build Failed!
    Check source for bad function call or global variable name `_printi'
    
  • jazzedjazzed Posts: 11,803
    edited 2014-09-14 10:28
    "Text Devices" is the older folder and should be removed.
  • SapphireSapphire Posts: 496
    edited 2014-09-14 10:33
    Jazzed,

    Success. It builds fine now. Thank you very much for enlightening me on this one!
Sign In or Register to comment.