- Error: Fatal C0247 - Exception occurred while generating Pcode
- Database connection popping up multiple times during full build
- Error: C0085 - Invalid variable declaration initialization
- Error: C0011 - Incompatible types in expression
- What causes an application to start slower from a solution vs. workspace in the IDE?
- Automatic save on non-visual object changes
When working with the new solution format, you may encounter certain errors or unexpected behaviors during builds. This section outlines some common issues, their causes, and recommended solutions.
This error typically occurs during incremental builds when there's a mismatch between source code and the previously generated Pcode.
In the solution format, each project maintains its own syntax tree and Pcode files. When a project is opened, the IDE checks for consistency between source code and Pcode. If a mismatch is detected, PowerBuilder prompts a "Request Compilation" message. Although this is expected behavior, incremental builds can still fail with a C0247 error if exceptions occur during Pcode regeneration.
This issue does not appear in full builds, as everything is recompiled from scratch, ensuring consistency.
Recommended solution:
-
Perform a full build if C0247 errors persist.
-
Ensure that all dependent libraries and projects are clean and up-to-date before triggering an incremental build.
During a full build, PowerBuilder launches multiple PBCC.exe processes to support multi-threaded compilation. Each of these processes may attempt to connect to the database independently when SQL statements are parsed or validated. As a result, developers may see the database connection dialog pop up multiple times, requiring repeated input.
Why this happens:
-
Each PBCC.exe instance runs in isolation and needs its own connection.
-
No session sharing occurs between concurrent processes.
Recommended solution:
-
To reduce or suppress connection prompts, go to:
Tools menu > System Options menu > General tab and enable: "Disable database connection when compiling and building".
In the solution format, a compilation error will occur if a global function is used to assign a value during the declaration of an instance variable.
In the workspace format, this might compile successfully, but can still fail during full builds unless the global function is compiled before the object that references it.
Problematic code:
int ii_before = gf_before()
This results in the following error:
Error C0085: Invalid variable declaration initialization
Recommended solution:
Move the assignment to a script section (e.g. an event or function).
In the instance variable:
// Declaration int ii_before
In an event or function:
// Assignment ii_before = gf_before()
In the solution format, performing operations between the any type and types such as char, boolean, object, datetime, date, or time will result in a compilation error.
In the workspace format, such code may compile without errors, although the actual behavior is often incorrect. In some cases, especially when executed in the open event of a window, it can even lead to a crash.
Problematic code:
any la_any string ls_ret la_any = 'abc' ls_ret = la_any + char(42)
This results in the following error:
Error C0011: Incompatible types in expression: any, character
Recommended solution:
Use the string() function to ensure proper type conversion and avoid errors.
ls_ret = string(la_any) + string(char(42))
Running an application from a solution in the IDE is slower than from a workspace is primarily due to runtime checks and incremental compilation designed to ensure code consistency.
-
Pcode change detection: The IDE checks whether any source code has changed since the last compile. This process typically takes 1-2 seconds.
-
Incremental compilation: If changes are detected - especially in base classes, object properties, global functions, or global variable definitions - the IDE automatically compiles affected objects before running. The time required depends on the complexity and number of related objects.
In contrast, a workspace does not perform these runtime checks. It assumes the necessary compilation was done at save time, so it launches faster - but with a higher risk of runtime inconsistencies if objects were changed and not rebuilt.
Once the application is running, performance is identical between solution and workspace.
When a Non-Visual Object is created, modified, or deleted within the current object (e.g., a window or user object), the IDE will automatically save the object. This automatic save occurs immediately without prompting the user. As a result, any unintended changes, such as accidentally deleting an NVO will be permanently saved.
You can try to use the Undo feature to reverse the changes. Before making some complex changes, it is recommended to use version control to track changes or back up the source files.