GCC compiler - using alternative libraries
Robert Richards (1993) 6 posts |
Hello, I am having an issue with !GCC. I can get it to compile just fine, except for when I attempt to use an alternative library. I’m probably doing something daft, please put me out of my misery! |
Robert Richards (1993) 6 posts |
OK, I’ve found out that desklib isn’t compatible with GCC4. But I still can’t get the SCL to work. I’ve also downloaded OSLib, but when I try to use it GCC returns an error saying that it can’t find the header files referenced in the programme source code. I have run the Obey file in the OSLib distribution. Tearing my hair out! I used to have GCC running just fine on a RiscPC many years ago, I really want to get stuck into some programming on the Raspberry Pi and make use of the GPIO but am stuck att he first hurdle (I know I don’t NEED these libraries), but it will make dealing with the WIMP so much easier. |
Garry (87) 184 posts |
How are you referring to the OSLib headers? Something like this: #include “oslib/wimp.h” ? I use Norcroft, not GCC, but that should be the same. Have you used the -I flag in GCC to refer to the OSLib environment variable? I’m not in front of my RISC OS machine to check my build scripts, but I think you’ll need to have something like -IOSLib in your GCC build command. Cheers Garry |
Robert Richards (1993) 6 posts |
Yes, #include <oslib/wimp.h> Then: Can’t recall the exact message but it’s along the lines of “wimp.h cannot be found or does not exist”. I tried running GCC with the verbos flag set, and it didn’t seem to be looking in the OSLib directory, but I can’t work out why. |
Chris Gransden (337) 1207 posts |
Assuming you’re using OSLib release 7.0 there should be an obey file called ‘Setvars’ which you need to run first. Here’s a simple makefile you can use as a template.
|
Garry (87) 184 posts |
You should be using #include “oslib/wimp.h”, not #include <oslib/wimp.h>, I would think. |
Steve Fryatt (216) 2105 posts |
Yes, #include <oslib/wimp.h> That should be
and
(note the quotes and the extra colon after OSLib). As Chris says, you’ll need to have run SetVars first so that |
Robert Richards (1993) 6 posts |
Thanks for the help – hadn’t spotted the colon in the gcc command. However, I still get GCC complaining: If I have GCC in verbose mode, I can see this: I have run the SetVars obery file in the oslib directory, the header files are all within a directory “h” within the oslib directory – I assume this is correct? Which I guess point to the directory in which the obey file resides as the location where the OSLib libraries may be found. So this should work. Is the facts that gcc refers to only /OSLib: rather than a proper path a clue? |
Chris Gransden (337) 1207 posts |
To confirm whether the Setvars obey file has run correctly bring up a taskwindow and type ‘filer_opendir OSLib:oslib.h’. This should open a filer window with the header files. The file ‘wimp’ should be there also. |
Robert Richards (1993) 6 posts |
If I type that comman after running setvars I get: Error when reading: I also tried this with OSLIB:wimp.h with similar results. So RISC OS is being pointed to the correct directory, but can’t find the header files? How can that be? |
nemo (145) 2546 posts |
Where’s the dot after the $? Anyway, oslib.h isn’t right at all, it ought to be oslib/h or be munged into h.oslib… but you certainly can’t use “oslib.h” as a leafname. |
Theo Markettos (89) 919 posts |
There should be a dot on the end of that (unless Textile ate it). In case anyone is tempted to say, C #includes are right to be in Unix format (#include “library/header.h”) not RISC OS format (#include “Library:h.header”) here. It’s the compiler’s job to translate that into the filenames as laid out on disc, and both RISC OS compilers do that. Running a compiler on the same code on another OS (say, Linux or Windows) would do their own filename handling, and indeed GCCSDK is capable of building the same code on Linux or Windows (via Cygwin) if the filenames are in Unix format. |