bad function call or global variable name _cog_run
Pliers
Posts: 280
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.
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
Before that I tried "ADD Simple Library" and I tried "Add include path" and "Add Library paths", but did not help.
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.
In the mean time, 2 questions:
1. What version of SimpleIDE are you using?
2. Are you working in Simple View or Project View?
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
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.
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.
I was a stumped because the project view was showing the header file.
Thanks again.