Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

Strange compile error

7 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

Hi,

I have a simple application that uses glut and opencv. However as soon as I add the opencv wrapper unit to the uses clause I get:

video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM"
found

The compiler does not recognize the main unit anymore. I have searched the opencv.pas file but I could not find anything strange there. Has anyone got an idea of what might be happening?

TIA,
Darius

Reply by email

Sven Barth
to Unknown author
Show quoted text 10 lines
Hi, I have a simple application that uses glut and opencv. However as soon as I add the opencv wrapper unit to the uses clause I get: video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM" found The compiler does not recognize the main unit anymore. I have searched the opencv.pas file but I could not find anything strange there. Has anyone got an idea of what might be happening?

It would help if you'd show us how your main program file looks like.

Regards,
Sven

Reply by email

Tomas Hajny
to Unknown author: I have a simple application that uses glut and opencv. However as soon as I add the…

On Thu, May 17, 2012 10:11, wrote:

Hi,

Show quoted text 10 lines
I have a simple application that uses glut and opencv. However as soon as I add the opencv wrapper unit to the uses clause I get: video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM" found The compiler does not recognize the main unit anymore. I have searched the opencv.pas file but I could not find anything strange there. Has anyone got an idea of what might be happening?

I'd assume a different video.pp file is found instead of the right one (possibly because the compiled version of unit video cannot be used for some reason). Try compiling with -vt to find out what happens there.

Tomas

Reply by email

Unknown author
to Sven Barth: It would help if you'd show us how your main program file looks like. Sven

Second try. My previous email with attachement got blocked probably. I will send the files now in two emails. Just put everything together in one folder.

Darius

Sven Barth wrote
[1] wrote
> Hi, I have

a simple application that uses glut and opencv. However as soon as I add the opencv wrapper unit to the uses clause I get: video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM" found The compiler does not recognize the main unit anymore. I have searched the opencv.pas file but I could not find anything strange there. Has anyone got an idea of what might be happening?

It would help if you'd show us how your main

program file looks like.

Show quoted text 5 lines
Regards, Sven

Reply by email

Unknown author
to Sven Barth: It would help if you'd show us how your main program file looks like. Sven

Here's the last file. See my previous email.

Sven Barth wrote
On 17.05.2012 10:11,
[1] wrote
> Hi, I have a simple application that uses glut and

opencv. However as soon as I add the opencv wrapper unit to the uses clause I get: video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM" found The compiler does not recognize the main unit anymore. I have searched the opencv.pas file but I could not find anything strange there. Has anyone got an idea of what might be happening?

It would

help if you'd show us how your main program file looks like.

Regards,

Sven _______________________________________________

Reply by email

Tomas Hajny
to Unknown author: Second try. My previous email with attachement got blocked probably. I will send the…
Second try. My previous email with attachement got blocked probably. I will send the files now in two emails. Just put everything together in one folder.

First, I'd recommend renaming your main program from video.pp to something else to avoid conflict with unit video which is one of RTL units.

Second, OpenCV uses unit Dialogs in its implementation. FPC provides unit Dialogs as part of the FreeVision package (fv). FreeVision uses unit Video, which is why adding OpenCV triggered your problem. However, I suspect that the original OpenCV did not intend to use FreeVision (considering the headers referring to use with Delphi) but rather some GUI support unit (assuming that a different unit with the same name may be distributed with Delphi and probably also Lazarus/LCL). I can see at least one call to a function probably provided by that unit being commented out in the provided source so it's possible that the reference to this unit (and the whole uses clause in the implementation section of OpenCV.pas - lines 1718 and 1719) may be removed. Once you fix these, there's a bunch of other problems, but these are not related to your original post.

Tomas

Reply by email

Darius Blaszyk
to Tomas Hajny

Hi Tomas,

That did the trick! I didn't notice the dialogs unit in the implementation section. After removing it everything works fine now. I got opencv running on windows and displaying the webcam feed on a opengl texture. I will put the code on the ccr as soon as I have access again. In the coming period I'll try to get it working for mac and linux as well after which the wrapper unit possibly could be added to the fpc packages hopefully.

Regards, Darius

Tomas Hajny wrote 31 lines
On Thu, May 17, 2012 11:07, wrote: > Second try. My previous email with attachement got blocked > probably. I will send the files now in two emails. Just put everything > together in one folder. First, I'd recommend renaming your main program from video.pp to something else to avoid conflict with unit video which is one of RTL units. Second, OpenCV uses unit Dialogs in its implementation. FPC provides unit Dialogs as part of the FreeVision package (fv). FreeVision uses unit Video, which is why adding OpenCV triggered your problem. However, I suspect that the original OpenCV did not intend to use FreeVision (considering the headers referring to use with Delphi) but rather some GUI support unit (assuming that a different unit with the same name may be distributed with Delphi and probably also Lazarus/LCL). I can see at least one call to a function probably provided by that unit being commented out in the provided source so it's possible that the reference to this unit (and the whole uses clause in the implementation section of OpenCV.pas - lines 1718 and 1719) may be removed. Once you fix these, there's a bunch of other problems, but these are not related to your original post. Tomas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email