Recent

Author Topic: Compile error  (Read 5070 times)

guest64142

  • Guest
Compile error
« on: October 18, 2019, 04:26:42 am »
In the course of troubleshooting hardware, I had to learn how to install what we call test points (and re-compile) that stop the s/w and display a status screen. I was able to do this in one file with no issues. Now I'm in another file and when I try to compile I get an "error 3: unknown identifier".

When I look up the error it says the identifier has not been declared OR is being used somewhere else (or something like that).

The cursor moves to under the first character of what I suppose is the offending identifier. The identifier has a carrot (^) right after it (no space). Like this: Fact^.. The same identifier is used in many of the source code files so I assume it has to be declared somewhere and I just have to link to it.  Is this correct? If so, how do I do that?

Thx!

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: Compile error
« Reply #1 on: October 18, 2019, 12:04:42 pm »
In the course of troubleshooting hardware, I had to learn how to install what we call test points (and re-compile) that stop the s/w and display a status screen. I was able to do this in one file with no issues. Now I'm in another file and when I try to compile I get an "error 3: unknown identifier".

When I look up the error it says the identifier has not been declared OR is being used somewhere else (or something like that).

The cursor moves to under the first character of what I suppose is the offending identifier. The identifier has a carrot (^) right after it (no space). Like this: Fact^.. The same identifier is used in many of the source code files so I assume it has to be declared somewhere and I just have to link to it.  Is this correct? If so, how do I do that?
The identifier is probably defined in another unit, so you have to include that unit in this unit's uses clause.

(Somehow this "simple" explanation ended up with a Gunning-Fog index of 14.  I hope this makes sense.)

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Compile error
« Reply #2 on: October 19, 2019, 06:16:33 pm »
Just for your information:  the carrot (^) means it is a pointer.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Compile error
« Reply #3 on: October 19, 2019, 06:51:11 pm »
Note the correct spelling is caret (carrot is a root vegetable in English).

guest64142

  • Guest
Re: Compile error
« Reply #4 on: October 21, 2019, 06:41:56 pm »
I looked in the file that will compile (and contains Fact^)and found a section just below the notes in the beginning that says "Uses" then lists a bunch of things (not sure what they are). Copied that section and pasted in the file that won't complile. Now getting Error 15: File not found (somefile.TPP).

When I wingrep somefile.TPP, it doesn't not show up in the source code. From what little I know abt Pascal, I think the *.TPP file is generated during complie. Is that correct? If it's not being created, why??

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Compile error
« Reply #5 on: October 21, 2019, 07:09:56 pm »
When I wingrep somefile.TPP, it doesn't not show up in the source code. From what little I know abt Pascal, I think the *.TPP file is generated during complie. Is that correct? If it's not being created, why??

Show us the code: it's difficult to debug otherwise, having to guess what you mean and what's in the source.

A .TPP is (was) a Turbo Pascal protected-mode compiled unit, so it has no place in a "uses" clause. Very generaly speaking, a uses clause should have just the names (without extension) of the "used" units, so copying something from a comment will not work in  most cases.

For example, one may add a comment:
Code: Pascal  [Select][+][-]
  1. { Uses:
  2. - system.tpu
  3. - crt.tpu
  4. }

but copying that directly as:
"  uses system.tpu, crt.tpu;  "
will not work; it should instead be:
"  uses system, crt;  "

Besides that, if a source file says it uses "SOMETHING.TPP" that's a rather clear indication that it's intended for Borland/Turbo Pascal and the code will probably need some tweaking to make it compile correctly (if at all) in Free Pascal.

HTH
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

ccrause

  • Hero Member
  • *****
  • Posts: 845
Re: Compile error
« Reply #6 on: October 21, 2019, 07:35:18 pm »
Show us the code: it's difficult to debug otherwise, having to guess what you mean and what's in the source.

+1

I looked in the file that will compile (and contains Fact^)and found a section just below the notes in the beginning that says "Uses" then lists a bunch of things (not sure what they are). Copied that section and pasted in the file that won't complile. Now getting Error 15: File not found (somefile.TPP).
You should rather search for the declaration of the variable in the source files, it will look more or less as follows :
Code: [Select]
Fact : PType;Or perhaps
Code: [Select]
Fact : ^Type;Note that Type in the snippet above is a placeholder for the actual type used. You need to include the unit containing this declaration in the units accessing Fact.

guest64142

  • Guest
Re: Compile error
« Reply #7 on: October 21, 2019, 07:58:16 pm »
Not sure if I can post the code since I signed a NDA.

The file (*.TPP) it errors for is not listed in the Uses clause. I assumed it was a file that that gets created during the compile process.

I wingrep the source code for " Fact:" and found this in a file:
Fact:= GetArrayAddrs('Fact');

The name of the file I found that in is listed in the Uses clause of the file I'm trying to compile. None of the items listed in Uses clause have an extension.

The orig error abt Fact^ is not showing up now after I added the Uses clause.  Since the Uses clause comes before the point where it errored for fact^, I'm not sure if I've addressed the Fact^ error or not. Maybe it's getting stuck before it gets there.

BTW, I'm using BP (Boreland-Pascal) ver 7.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Compile error
« Reply #8 on: October 21, 2019, 08:06:45 pm »
It looks like you do not have the *full* sourcecode of the original. It seems that the sources for one of more tpu's/tpp's is missing.
(And you are also making some very basic mistakes regarding uses, as already pointed out above)
FPC can not link against binary TPU's. It is only sourcecode compatible.

If my  hunch is correct and you do not have the full sources for all modules TPU's/TPP's, you are in big trouble....
In that case you need to reverse engineer the missing code parts based on the interface units (TPI)  :o
« Last Edit: October 21, 2019, 08:16:02 pm by Thaddy »
Specialize a type, not a var.

guest64142

  • Guest
Re: Compile error
« Reply #9 on: October 21, 2019, 09:01:13 pm »
It looks like you do not have the *full* sourcecode of the original. It seems that the sources for one of more tpu's/tpp's is missing.

This is one of the things I'm trying to determine. When the TPU/TPP files are created. If they're supposed to be on the source code disk or if they get created during the compiling process.


(And you are also making some very basic mistakes regarding uses, as already pointed out above)

Telling me there's a mistake without pointing it out doesn't help much


FPC can not link against binary TPU's. It is only sourcecode compatible.
No clue what this means. I'm a beginner..

If my  hunch is correct and you do not have the full sources for all modules TPU's/TPP's, you are in big trouble....
In that case you need to reverse engineer the missing code parts based on the interface units (TPI)  :o
This isn't going to happen. I'm NOT a s/w guy.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Compile error
« Reply #10 on: October 21, 2019, 09:08:01 pm »
Quote
Telling me there's a mistake without pointing it out doesn't help much
It was already pointed out to you, no need for me to repeat it.
I suggest you read the BP7 manuals if available. You may start with the free TP5.5 version if it is not available on-line.
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: Compile error
« Reply #11 on: October 21, 2019, 09:21:50 pm »
The solution is easy. Use Free Pascal  :)

Other compilers are not on-topic on this forum.

For questions about other compilers try a generic forum like www.stackoverflow.com
« Last Edit: October 21, 2019, 09:23:47 pm by marcov »

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Compile error
« Reply #12 on: October 21, 2019, 09:42:15 pm »
The solution is easy. Use Free Pascal  :)
Yes but if you want to port a BP7 program you need some knowledge of TurboPascal and its files.
He does not have that knowledge. As such I find it on-topic since it is related to porting code.
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: Compile error
« Reply #13 on: October 21, 2019, 10:05:55 pm »
The solution is easy. Use Free Pascal  :)
Yes but if you want to port a BP7 program you need some knowledge of TurboPascal and its files.

Yes. But you can also get such knowledge (if the source is complete) by compiling with Free Pascal, an more important FPC is nowhere in the OP's post, so it doesn't seem to be about porting.

guest64142

  • Guest
Re: Compile error
« Reply #14 on: October 21, 2019, 10:18:44 pm »
I've had no luck finding an active beginners forum for Boreland Pascal. That's why I'm here. I'm assuming I'm making a simple mistake since I've never been down this road before. Stackoverflow isn't for beginners at all.

I don't see where anyone has pointed out what I'm doing wrong with Uses clause other than stating you are not supposed to use extensions, which I haven't. Not sure how that ever came up.

I just stumbled upon, a file called deltpp.bat. Looks like it deletes a number of TPP files after compiling?? Maybe I can re-install the s/w with this file re-named??


 

TinyPortal © 2005-2018