GPCP Unhandled Exception

General discussions about working with the Component Pascal IDE and programming .NET using Gardens Point Component Pascal (GPCP)
Post Reply
Helpdesk
Posts: 37
Joined: Sat Jan 01, 2011 5:43 am
Contact:

GPCP Unhandled Exception

Post by Helpdesk » Tue Feb 22, 2022 11:02 pm

I have installed Component Pascal and CPIde on my Windows 10 laptop. When I try to compile the simple "Hello World" example within CPIde I see:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at GPBinFiles.GPBinFiles.findOnPath(Char[] pathName, Char[]
fileName) in
c:\Users\xxxx\CurrentProjects\CVS-GPCP-NET\sources\libs\csharp\GPBinFiles.cs:line
95
at NewSymFileRW.SymFileReader.Parse(BlkId scope) in NewSymFileRW.cp:line 1162 at NewSymFileRW.ImpResScope.ReadThisImport(BlkId imp) in NewSymFileRW.cp:line 2147 at NewSymFileRW.NewSymFileRW.WalkImports(ScpSeq& imps, BlkId modI) in NewSymFileRW.cp:line 2182 at CPascalP.CPascalP.ImportList(BlkId modScope) in CPascalP.cp:line 467 at CPascalP.CPascalP.CPmodule() in CPascalP.cp:line 235 at CPascalP.CPascalP.Module() in CPascalP.cp:line 3437 at CPascalP.CPascalP.Parse() in CPascalP.cp:line 3457 at CPascal.CPascal.Compile(Char[] nam, Int32& retVal) in CPascal.cp:line 138 at gpcp.gpcp..CPmain(String[] A_0) in gpcp.cp:line 42
Any idea where I might have made a mistake?

cfbsoftware
Site Admin
Posts: 517
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: GPCP Unhandled Exception

Post by cfbsoftware » Tue Feb 22, 2022 11:09 pm

The clues in the exception traceback report are the procedure calls GPBinFiles.findOnPath and NewSymFileRW.SymFileReader.Parse.

This indicates to me that it is in the process of looking for symbol files on your path. As this is a new installation I suspect that the CPSYM environment variable required by GPCP has not been setup properly, or is not visible to your current Windows user when you are running the compiler. Refer to Section 2 in the GPCP Getting Started documentation.

You can check the value of CPSYM by starting a command prompt (e.g. by running cmd, or Start > All Programs > Accessories > Command Prompt)

In the command window type:

Code: Select all

echo %CPSYM%
On my system the command and resulting response looks like:

Code: Select all

C:\Users\CFB Software>  echo %CPSYM%
.;C:\GPCPx\symfiles\NetSystem\;C:\GPCPx\symfiles\;

JonRobertson
Posts: 1
Joined: Wed Oct 04, 2023 7:35 pm

Re: GPCP Unhandled Exception

Post by JonRobertson » Wed Oct 04, 2023 7:47 pm

I just installed CP and CPIde 8.1 and I am having the same issue, as well as a couple others when compiling the example projects.

I verified that CPSYM is set and that the dirs/folders in CPSYM are correct.

Code: Select all

echo %CPSYM%
.;C:\Users\jonro\gpcp-NET\symfiles;C:\Users\jonro\gpcp-NET\symfiles\NetSystem
I can compile Hello.cp using gpcp at the command line without errors:

Code: Select all

C:\Prj\CP\Hello>gpcp Hello.cp
#gpcp: Created Hello.exe
#gpcp: <Hello> No errors
But attempting to compile with CPIde results in this exception:

Code: Select all

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at GPBinFiles.GPBinFiles.findOnPath(Char[] pathName, Char[] fileName) in c:\Users\john\CurrentProjects\CVS-GPCP-NET\sources\libs\csharp\GPBinFiles.cs:line 95
   at NewSymFileRW.SymFileReader.Parse(BlkId scope) in NewSymFileRW.cp:line 1162
   at NewSymFileRW.ImpResScope.ReadThisImport(BlkId imp) in NewSymFileRW.cp:line 2147
   at NewSymFileRW.NewSymFileRW.WalkImports(ScpSeq& imps, BlkId modI) in NewSymFileRW.cp:line 2182
   at CPascalP.CPascalP.ImportList(BlkId modScope) in CPascalP.cp:line 467
   at CPascalP.CPascalP.CPmodule() in CPascalP.cp:line 235
   at CPascalP.CPascalP.Module() in CPascalP.cp:line 3437
   at CPascalP.CPascalP.Parse() in CPascalP.cp:line 3457
   at CPascal.CPascal.Compile(Char[] nam, Int32& retVal) in CPascal.cp:line 138
   at gpcp.gpcp..CPmain(String[] A_0) in gpcp.cp:line 42

cfbsoftware
Site Admin
Posts: 517
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: GPCP Unhandled Exception

Post by cfbsoftware » Fri Oct 06, 2023 6:28 am

Maybe because you are using two different user names: john and jonro?

Post Reply