Shop OBEX P1 Docs P2 Docs Learn Events
bad function call or global variable name _cog_run — Parallax Forums

bad function call or global variable name _cog_run

PliersPliers Posts: 280
edited 2014-05-27 14:35 in Learn with BlocklyProp
I seem to have an issue with the cog_run function
I have the latest LEARN folder. Downloaded today.
I can run only the print function and see it work on the terminal, but when I add a cog_run I get the error shown below.

[COLOR=#333333][FONT=Lucida Console]#include "simpletools.h"
[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]void led();[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]
[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]void main()[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]
[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]{
[/FONT][/COLOR]print("Hello! Goodbye ***");[COLOR=#333333][FONT=Lucida Console]
[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]cog_run(&led,10);[/FONT][/COLOR][COLOR=#333333][FONT=Lucida Console]
}

[/FONT][/COLOR]void led()
{
high(17);
}[COLOR=#333333][FONT=Lucida Console]
[/FONT][/COLOR]
Project Directory: C:/Users/steve/Documents/SimpleIDE/My Projects/
propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2162)
propeller-elf-gcc.exe -I . -L . -I ../Learn/Simple Libraries/Utility/libsimpletools -L ../Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Users/steve/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/Welcome.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 Welcome.c -lm -lsimpletools -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm -lsimpletools -lm -lsimpletools -lm -lm -lsimpletools -lm
Welcome.c:29:1: warning: return type defaults to 'int' [enabled by default]
Welcome.c: In function 'main':
Welcome.c:32:1: warning: implicit declaration of function 'cog_run' [-Wimplicit-function-declaration]
C:\Users\steve\AppData\Local\Temp\ccURC2qZ.o: In function `_main':
(.text+0x1d): undefined reference to `_cog_run'
collect2: ld returned 1 exit status
Done. Build Failed!


Check source for bad function call or global variable name `_cog_run'







Comments

  • PliersPliers Posts: 280
    edited 2014-05-27 10:10
    I was able to get it to run by saving my project in the learn folder.
    Before that I tried "ADD Simple Library" and I tried "Add include path" and "Add Library paths", but did not help.
  • PliersPliers Posts: 280
    edited 2014-05-27 10:17
    So.... If I don't want to keep my new projects in the learn folder, how do I get the path setup correctly?
  • PliersPliers Posts: 280
    edited 2014-05-27 10:34
    Ok, so now I'm totally confused.
    I renamed the project and tried saving it in different directories, but it won't compile in any of them. Not even back in the learn folder, where it worked once before.
  • Steph LindsaySteph Lindsay Posts: 767
    edited 2014-05-27 10:41
    Hmmm, that is odd. Andy will join this thread ASAP.

    In the mean time, 2 questions:

    1. What version of SimpleIDE are you using?
    2. Are you working in Simple View or Project View?
  • PliersPliers Posts: 280
    edited 2014-05-27 10:49
    Thanks for the quick response.
    I downloaded it today. Version 0.9.45
    I have flipped back and forth on Simple and Project view.

    No hurry here. Just trying to learn SimpleIDE.
    I can go to the GCC Demos and the Blinkcogs works.
    I see that it does not use the simpletools.h
  • edited 2014-05-27 11:36
    Hello there Pliers,

    The symptoms you are experiencing are probably because the location of the Learn folder is different from what SimpleIDE thinks it is. (Or maybe the old Learn folder is still there, and the new one you downloaded is somewhere else.) When you saved the project to the Learn folder, SimpleIDE was probably able to compile it because the first thing SimpleIDE does is check for libraries that are in subfolders of its current directory. So, when the project was within the Learn folder, it was able to go find simple tools library. In contrast, when it was in My Projects, SimpleIDE did not see a subfolder that contained the simpletools library, and in addition the library path was not pointing to the correct Learn folder.

    I think you'll be able to fix this by clicking SimpleIDE's Tools menu and selecting Properties. In the GCC Folders tab, there's a Library Folders field. Click Browse for that field, and make sure it is pointing to the Simple Libraries folder. For example, my Simple Libraries folder is in C:\Users\alindsay\Documents\SimpleIDE\Learn\Simple Libraries.

    Also, the Learn folder that you downloaded, it has to be unzipped, and replace the learn folder within ...Documents\SimpleIDE\. ...and make sure it's not a Learn folder within a Learn folder. If you have a Learn subfolder within the Learn folder that came with SimpleIDE, the compiler is probably looking for the older version. So, make sure to delete the Learn folder that comes with SimpleIDE. Then unzip the Learn folder you downloaded, and make sure that there isn't a Learn folder within a Learn folder. The example screen caps below show what it should look like:

    Click Tools -> Properties, then click Browse next to the Library Folder field.

    attachment.php?attachmentid=108881&d=1401215946

    When you do so, it should resemble this. If you do not see Robotics as a subdirectory, it's not the Learn folder you downloaded. Try replacing it again. This example is for C:/Users/alindsay/Documents/SimpleIDE/Learn/Simple Libraries.

    attachment.php?attachmentid=108880&d=1401215943
    718 x 457 - 245K
    518 x 351 - 142K
  • edited 2014-05-27 11:53
    In case you read the previous post right after I upped it, try re-reading. I had to make some corrections.
  • PliersPliers Posts: 280
    edited 2014-05-27 12:21
    Thanks. It was a path issue. I confused Program Files/ SimpleIDE/ Learn.... with User/Documents/SimpleIDE/Learn.

    I was a stumped because the project view was showing the header file.

    header.jpg


    Thanks again.
    580 x 207 - 45K
  • edited 2014-05-27 14:35
    Ah, good, yes, that would explain the symptoms. The SimpleIDE software copies the SimpleIDE workspace folder from Program Files/SimpleIDE/... to ...Documents/ any time it sees that it's not there. That way, if multiple users on the same computer run SimpleIDE, each will get their own copies of the workspace folder the first time they run SimpleIDE. With the Learn folder in the correct location, projects can be saved just about anywhere, not just to ...Documents/SimpleIDE/My Projects. By placing the updated Learn folder in ...Program Files (x86)/SimpleIDE, SimpleIDE only found the older version when it looked in ...Documents/SimpleIDE. Parallax is taking steps to automate this process so that in the future, you will not have to delete one Learn folder and replace it with another.
Sign In or Register to comment.