forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Resource not found message

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2360
Location: Yateley, Hants, UK

PostPosted: Fri Jan 20, 2023 11:28 am    Post subject: Resource not found message Reply with quote

Why is it that sometimes a resource listed in a RESOURCES section or in a separately compiled .RC file cannot be found, and FTN95 tells you this in a "Resource not found" message? (Apart from the obvious, that FTN95 hasn't found it - but why?)

I can understand it if the path has a space in it.

The workaround that I discovered many years ago is to put the resource name in double quotes, as in:

Code:
NEW         BITMAP   "NEW.BMP"
OPEN        BITMAP  "OPEN.BMP"
SAVE        BITMAP  "SAVE.BMP"


and I do it by default these days, but FTN95.CHM has numerous examples where the quotes are not used. Why should that solve the problem?

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7550
Location: Salford, UK

PostPosted: Fri Jan 20, 2023 11:52 am    Post subject: Reply with quote

I am not sure but for 64 bit applications the RESOURCES directive only works when using /LINK or /LGO on the command line.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2360
Location: Yateley, Hants, UK

PostPosted: Fri Jan 20, 2023 5:31 pm    Post subject: Reply with quote

Hi Paul,

I'll pass it on. I generally use SRC for some applications, and RESOURCES for others. It's been a while since I saw the issue, but recognised it when someone else had it.

Eddie
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1075
Location: Morrison, CO, USA

PostPosted: Sat Jan 21, 2023 5:13 am    Post subject: Reply with quote

And don't forget to double the backslashes when you specify a path, even in double quotes.
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1075
Location: Morrison, CO, USA

PostPosted: Sat Jan 21, 2023 5:15 am    Post subject: Reply with quote

BTW: The HELP files are created with a different utility that requires different syntax. So spaces aren't really an issue. It's a hyperlink, after all.
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2360
Location: Yateley, Hants, UK

PostPosted: Sat Jan 21, 2023 12:58 pm    Post subject: Reply with quote

Bill,

I'm confused now. I put all my resources in the same sub-directory, so for a logo bitmap that I'll put on a drawing with IMPORT_IMAGE@, I might have:

Code:
      RESOURCES
      LOGO  IMAGE LOGO.BMP


When in past years, I had the message, I trained myself to write:

Code:
      LOGO IMAGE "LOGO.BMP"


I've never used anything from another folder, but if I did, I might expect to write:

Code:
      LOGO IMAGE "C:\MyLogos\LOGO.BMP"


Are you suggesting that it needs to be:

Code:
      LOGO IMAGE "C:\\MyLogos\\LOGO.BMP"


I'd be happy to find that it was a solution, but where does it say that in the Help file(s)? If I doubled the backslashes, could I dispense with the quotes? Or are you referring to hypertext resources which do have multiple slashes? (As in note 356 in CWPLUS.ENH) I don't use those.

Eddie
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1075
Location: Morrison, CO, USA

PostPosted: Sat Jan 21, 2023 2:49 pm    Post subject: Reply with quote

Here is my "standard" resource file with an error introduced in the path name of my_warning. I've only included a couple of lines before and after. The path name has spaces, so has to be in quotes. The inclusion of the quotes necessitates the syntax change.
Code:

        redsquare          bitmap      z:\cmasterf95\red16x.bmp
        greensquare      bitmap      z:\cmasterf95\green16check.bmp
        my_warning       icon           "Z:\CMASTERF95\\BMP and Icons\\my_warning.ICO"
        my_undef          icon           "Z:\\CMASTERF95\\BMP and Icons\\STRIPE_Y_R.ICO"
        my_error           icon           "Z:\\CMASTERF95\\BMP and Icons\\my_error.ICO"


Here's the error I get using SRC.
Code:
[Silverfrost SRC/WIN32 Ver 4.60 Copyright (c) Silverfrost Ltd 2022]
 1/0010           my_warning    icon    "Z:\CMASTERF95\\BMP and Icons\\my_warning.ICO"
WARNING - Unrecognised escape character \C in string literal - '\' ignored (In include file Z:\CMASTERF95\STANDARD_RESOURCES.RC)
 1/0011         my_undef        icon    "Z:\\CMASTERF95\\BMP and Icons\\STRIPE_Y_R.ICO"
*** Unable to open file Z:CMASTERF95\BMP AND ICONS\MY_WARNING.ICO (In include file Z:\CMASTERF95\STANDARD_RESOURCES.RC)
    1 ERRORS  [<CMAIN_RESOURCESSRC/WIN32 Ver 4.60]
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1075
Location: Morrison, CO, USA

PostPosted: Sat Jan 21, 2023 3:03 pm    Post subject: Reply with quote

And, no, so far as I can tell there is no reference in the documentation to using the double backslashes for a path name that is in double quotes within a resource file.

I discovered this as I was cleaning up my main folder, putting my icons and BMP's into their own folder.

I don't happen to use hypertext (%ht) either, so I cannot comment on syntax there. However, it is very likely that the same syntax requirement would persist when using a resource file and something like:

Code:

HYPSOMEINFO HYPERTEXT "info1.htm"

where the file must be listed with a pathname.

Above was used an example in ADD_HYPERTEXT_RESOURCE@.
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7550
Location: Salford, UK

PostPosted: Sat Jan 21, 2023 3:35 pm    Post subject: Reply with quote

SRC is an adaptation of the C++ compiler SCC so the strings are C strings and the backslash is an escape character.

Code written for a Fortran compiler uses Fortran CHARACTER variables and literal constants where the backslash is like any other character.

I agree that the documentation ought to say this.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2360
Location: Yateley, Hants, UK

PostPosted: Mon Jan 23, 2023 11:32 pm    Post subject: Reply with quote

I'd have never found the double slash solution! If I'd had the message about \C being unrecognised, that would have pointed to where the error was, but not how to solve the problem*. Was the other error because the file wasn't there? The error that provoked me in the first place occurred when the program was run.

Eddie

*I can often go to the root of the problem with Fortran syntax errors (but not always at first): RESOURCES are a different matter. Fortunately, there aren't that many mistakes you can make.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1075
Location: Morrison, CO, USA

PostPosted: Wed Jan 25, 2023 4:17 am    Post subject: Reply with quote

Eddie,

I went back to re-read your original posting. There are at least two different questions posed, and I apologize if I took it off of the actual topic.

The one that refers to FTN95.CHM and path names has nothing to do with Resource Files that are tied to a compiled program. The HELP file is a separate entity, with it's own syntax requirements, BEFORE you run it through the program that actually builds the HELP file that you see as FTN95.CHM.

Since SRC is a C-Compiler "variant", it is quite possible that some of the syntax held over (Paul could comment on that, I'm guessing) for how file names and paths are handled syntactically.

In "C", if you specify a file name in <> brackets, it is a global (aka system) filename. One uses this for #include's for system declarations, as an example. if the file name is enclosed in double quotes, the file is assumed to be local to the current working directory or uses one of the specified paths supplied on the command line or an environment string. S

So, maybe, with only a file name present, the SRC resource compiler looks-for/compiles-for one place for the file, and if in double quotes, it looks elsewhere. Or, if the full path name is specified, it looks specifically at one place only.

And, it is possible, since you can bind resources at run-time, that all that exists in the compiled code are resources that can be found, and if not found are only references to external resources that would not likely be found on a user's system.

Not knowing exactly how a resource file is constructed, I'm only guessing, but it is logical guessing!

Bill
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2360
Location: Yateley, Hants, UK

PostPosted: Wed Jan 25, 2023 6:16 pm    Post subject: Reply with quote

Hi Bill,

I suspect that you have read more into the second question than I intended. I'm reading FTN95.CHM with the Mk 1 eyeball as a substitute for a printed manual, which I hanker after. I suppose that I could look at PLATO's help, but my first goto is that CHM file. I'm certainly not smart enough to parse it as a C compiler would!

The examples I've seen all look not to have paths.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group