Resolving GlobalDefinitions.h Missing Error in WinCC V13

David Krause12 min read
SiemensTroubleshootingWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Resolving GlobalDefinitions.h Missing Error in WinCC Professional V13

The compiler error Line(3): can not find #include file GlobalDefinitions.h is one of the most common build-time failures reported by engineers using ANSI-C actions in WinCC Professional (TIA Portal V13) and the WinCC RT Professional runtime. The error blocks script compilation, halts HMI screen change logic, and prevents C-based VB-style global scripts from being deployed to the runtime. This article gives a complete, field-tested resolution path: identifying the root cause, restoring the missing header, fixing the project include path, and verifying the fix in the TIA Portal and at runtime.

Engineering note: WinCC Professional V13 ships the RT Professional API in the installation directory under Apilib or SDK subfolders. The header GlobalDefinitions.h is the umbrella include that pulls in common types, CMN_ERROR, DM_xxx and TLG_xxx constants. If TIA Portal cannot find it, the C-script compiler aborts on the very first line of the user code.

1. Problem Description

When compiling an ANSI-C action, function, or global script in a WinCC Professional V13 project, the TIA Portal output window reports the following diagnostic message:

Line(3): can not find #include file GlobalDefinitions.h
Compiling action: <ProjectName>.PRJ_1\ScriptLib\MyAction
Error: 1 error(s), 0 warning(s)
Build failed.

The same wording appears in the Compile & Check log, in the TIA Portal Info pane, and in the WinCC RT Professional download log. The build status of the HMI station is set to Not compiled, and subsequent online downloads of the HMI to the runtime are rejected with HMI compile errors.

1.1 Where the Error Originates

The error is emitted by the WinCC RT Professional C compiler (a derivative of the Microsoft C/C++ compiler front-end). The header GlobalDefinitions.h is referenced by the project either explicitly via a user-written #include "GlobalDefinitions.h" line, or implicitly when the user activates WinCC RT Professional API functions (data management, logging, alarms, tag interface) inside an action.

1.2 Scope of Impact

Item Behavior when error is present
ANSI-C actions / functions Compile fails, status bar shows red X
VBScript actions Not affected (VBScript does not parse .h headers)
Global scripts C library Compiles fail, only the empty placeholder is generated
Graphical screen compilation Often succeeds, but the runtime blocks startup
HMI download to RT Aborted with HMI_0017 "HMI contains errors"
RT Professional runtime Refuses to start, event log shows "script library not found"

2. Affected Versions and Components

The GlobalDefinitions.h header is delivered with every install of WinCC RT Professional starting with TIA Portal V13. Confirmed affected versions:

  • WinCC Professional V13 (TIA Portal V13, V13 SP1, V13 SP2)
  • WinCC Professional V14 / V14 SP1 (legacy path, same header)
  • WinCC Professional V15, V15.1, V16, V17 (path changed to PublicAPI)
  • WinCC RT Professional V20 (current branch, header is bundled with the SDK)

On TIA Portal V13 the header is located in the WinCC installation directory, typically:

C:\Program Files\Siemens\Automation\WinCC RT Professional\Apilib\GlobalDefinitions.h
or
C:\Program Files (x86)\Siemens\Automation\WinCC RT Professional\Apilib\GlobalDefinitions.h
Path note for V13: Older V13 builds placed the API under ...\WinCC RT Professional\SDK\Include. The exact subfolder name depends on Service Pack level. Always search the install root for GlobalDefinitions.h first.

3. Root Cause Analysis

Three distinct root causes account for ~99% of the field reports. Identify the correct one before applying a fix.

3.1 Cause A – Manual #include Added by the User

The most frequent cause: an engineer copies a code snippet from a Siemens sample, forum post, or PDF and pastes the literal line #include "GlobalDefinitions.h" into a C action. The snippet is intended for a different project (e.g., a custom DLL that links against the WinCC ODK) and the header is irrelevant to the action. TIA Portal cannot find the header because no include path has been configured to point at Apilib, and the action does not need any RT API to function.

Diagnostic marker: Line 3 of the action is exactly #include "GlobalDefinitions.h", and no other RT API calls (DM_xxx, TLG_xxx, ALG_xxx) are used in the same function.

3.2 Cause B – Include Search Path Missing or Wrong

The action legitimately calls RT API functions (e.g., DMGetValue, TLGConnect). TIA Portal must therefore know where to find GlobalDefinitions.h. The WinCC installation adds the Apilib folder to the global compiler include path automatically only when WinCC RT Professional is installed. If the user installs TIA Portal first and skips the WinCC RT Professional option, or repairs the TIA Portal install and deselects the runtime, the include path is removed and the project fails to compile.

Diagnostic marker: The TIA Portal installation path C:\Program Files\Siemens\Automation\WinCC RT Professional\Apilib\ does not exist, or exists but TIA Portal was installed after the runtime was uninstalled.

3.3 Cause C – Corrupt or Partial WinCC Installation

The header file is physically missing from the install media (rare, happens on customized IT images) or has been deleted by antivirus quarantine, disk cleanup, or a third-party backup tool. The TIA Portal log under %TEMP%\Siemens\TIA Portal\<version>\logs shows file-not-found warnings on the missing .h.

Diagnostic marker: dir /s C:\Program Files\Siemens\Automation\GlobalDefinitions.h returns "File Not Found".

4. Pre-Diagnostics Checklist

Run these steps before changing any code or installation. They isolate the root cause in under five minutes.

  1. Open the failing C action in TIA Portal V13 and read line 1–10. If line 3 is exactly #include "GlobalDefinitions.h" and no RT API function is used → Cause A.
  2. Open Windows Explorer, navigate to C:\Program Files\Siemens\Automation\WinCC RT Professional\. If the folder does not exist → Cause B. If Apilib\GlobalDefinitions.h exists → go to step 3.
  3. From an elevated command prompt, run dir /s "C:\Program Files\Siemens\Automation\GlobalDefinitions.h". If the file is not present anywhere → Cause C.
  4. Check Control Panel → Programs and Features. Confirm that SIMATIC WinCC RT Professional is installed and matches the TIA Portal version (V13 with V13, V14 with V14). A V13 TIA Portal cannot consume a V14 RT Professional runtime cleanly.
  5. Right-click the HMI station in the project tree, choose Compile → Software (rebuild all). Capture the full compile log to a text file for later comparison.

5. Resolution Path A – Remove the Spurious #include

Use this path when the diagnostic checklist identifies Cause A: the header is referenced but the action does not call any RT API function.

  1. Open the affected C action in the TIA Portal script editor.
  2. Delete the line #include "GlobalDefinitions.h".
  3. If a trailing blank line remains, leave it – ANSI-C is whitespace tolerant.
  4. Click Compile → Check Block in the script editor toolbar, or press F7.
  5. Verify the Info pane shows "0 error(s), 0 warning(s)".
  6. Save the action with Ctrl + S.
Engineer caveat: If the action was pasted from an ODK sample, also check for companion headers such as apdefap.h, apdlgapi.h, or apmglob.h. The same problem repeats for any of them.

6. Resolution Path B – Restore the Include Search Path

Use this path when the WinCC RT Professional runtime is installed but TIA Portal cannot locate the header. The fix is to either reinstall the runtime component or to add the include folder to the project.

6.1 Reinstall WinCC RT Professional

  1. Close TIA Portal V13 and stop the Siemens TIA Portal V13 service from services.msc.
  2. Insert the original TIA Portal V13 installation media (DVD or mounted ISO).
  3. Run Start.exe as administrator, choose Modify installation.
  4. Select SIMATIC WinCC RT Professional and complete the wizard. The installer re-registers the API folders and restores the compiler include path.
  5. Reboot the engineering station.
  6. Open the project, recompile the HMI, confirm the error is gone.

6.2 Manually Add the Include Path

For TIA Portal V13 the global C compiler include path is stored in the registry. Adding Apilib manually is not officially supported, but the following procedure is used as a temporary workaround when the installer media is not available:

  1. Locate the API header set: C:\Program Files\Siemens\Automation\WinCC RT Professional\Apilib\
  2. Copy the entire Apilib folder to a project-local directory, e.g., D:\Projects\MyHMI\Include\
  3. Open the TIA Portal project, right-click the HMI station → Properties → Compiler.
  4. Append the local include path; in V13 the field is a plain semicolon-separated list under Additional include directories.
  5. Recompile.
Warning: The manual include path workaround bypasses the TIA Portal lifecycle manager. After a TIA Portal update the path may need to be reapplied. Prefer the reinstall path for permanent systems.

7. Resolution Path C – Repair or Restore the Header File

Use this path when the GlobalDefinitions.h file is physically missing on disk.

  1. Search for the file in the backup or image repository: dir /s D:\Backups\GlobalDefinitions.h
  2. If a backup exists, copy it to C:\Program Files\Siemens\Automation\WinCC RT Professional\Apilib\
  3. If no backup exists, extract the file from the TIA Portal V13 installation media: DVD:\Support\RT_Professional\Apilib\GlobalDefinitions.h
  4. Add the Authenticated Users read permission on the file and folder.
  5. Add the SYSTEM account full control on the folder (TIA Portal compiler runs as SYSTEM in some configurations).
  6. Recompile the HMI project.

8. ANSI-C vs VBScript – What the Include Means

Only ANSI-C actions and global C functions are affected. VBScript actions parse a different language and do not honor #include. The mapping below clarifies which script type uses which header.

Script type Header behavior Triggers error?
ANSI-C action Compiles through WinCC C front-end, requires GlobalDefinitions.h only if API is used Yes, if line is present and header is missing
ANSI-C function Same as action, included into global script library Yes
VBScript action Script engine parses VBScript, no #include support No
VBScript function Same as VBScript action No
VB.NET macro (V13+) Uses .NET reference assemblies, not .h No

9. Related API Error Codes

When the script finally compiles and runs, the RT Professional runtime can still return API errors. The two structures most often encountered in the field are documented in the official Siemens documentation:

9.1 Data Management Errors – DM_E_SYS_ERROR 0x10000000

The CMN_ERROR structure filled by the Data Management API returns a base error code of 0x10000000 when a system-level fault is detected (e.g., memory allocation failure, internal queue overflow). The full list of DM error codes and their meaning is published in the official WinCC Runtime API reference.

Reference: Error messages (RT Professional) – Data Management – Siemens TIA Portal documentation

9.2 Tag and Logging Errors – TLG_API_ERROR 0x10000000

The Tag and Logging API uses the same base code 0x10000000 for the CMN_ERROR error structure, with sub-codes distinguishing between tag access faults, log queue overflow, and license violations. Inspect the lower 24 bits of dwError1 in the CMN_ERROR structure for the specific fault.

Reference: Error messages (RT Professional) – Tag and Logging – Siemens TIA Portal documentation

9.3 Archiving Error: "Connection to HMI data log interrupted"

When the HMI project is using the Energy Suite or any data-logging function, a common runtime alarm is "Archiving error: Connection to HMI data log interrupted". Siemens support article 109763475 documents the cause: the time between the S7 CPU and WinCC Professional is not synchronized, the storage path is no longer reachable, or the SQL Server Express instance used for the HMI logs is stopped. The fix is to verify NTP/time sync, the storage path, and the SQL service state.

Reference: Siemens Support article 109763475 – Archiving error in WinCC Professional with Energy Suite

10. Verification Procedure

After applying the fix, run this end-to-end verification. Each step has a pass/fail criterion that is unambiguous in the engineering log.

  1. Step 1 – Compile. In TIA Portal V13 right-click the HMI station → Compile → Software (rebuild all). Expected log: "0 error(s), 0 warning(s)".
  2. Step 2 – Build status. Check the project tree icon. The red cross over the HMI station should be replaced by a green check mark.
  3. Step 3 – Header location. From Start → Search, run GlobalDefinitions.h. The Windows indexer should return at least one hit in the Apilib folder.
  4. Step 4 – Runtime start. Download the HMI to the runtime PC. Open the WinCC RT Professional explorer. The script library ProjectName.dll should load without "script library not found" in the diagnostic trace.
  5. Step 5 – Function test. Trigger the screen change or function that the action is bound to. Verify the expected behavior in the runtime.
  6. Step 6 – Log review. In the WinCC RT Professional Diagnostic Viewer or the Windows Event Log under Siemens Automation / WinCC RT Professional, confirm no new errors appear within 10 minutes of normal operation.

11. Preventive Measures

Apply these controls on every new WinCC Professional project to avoid the error recurring.

  • Template header policy. Define a project standard that disallows manual #include lines in plain actions. Use the global script library instead for shared declarations.
  • Installation media lock. Pin the TIA Portal V13 and WinCC RT Professional versions in the engineering image. Document the exact build numbers in the project README.
  • Antivirus exclusion. Add C:\Program Files\Siemens\Automation\ to the antivirus exclusion list to prevent accidental quarantine of .h and .lib files.
  • Backup cadence. Back up the full Siemens\Automation tree nightly to allow a one-step restore of the API header set.
  • Compile gate in CI. If a TIA Portal project is exported to XML, run a CI step that re-imports and recompiles the HMI to catch missing-header issues before deployment.

12. Troubleshooting Matrix

Symptom Likely cause First action Reference
Line(3): can not find #include file GlobalDefinitions.h Manual #include without API usage Delete the line, recompile Section 5
Same error, project uses DMGetValue / TLGConnect RT Professional not installed or path stripped Modify install, add WinCC RT Professional Section 6.1
Same error, header missing on disk Antivirus cleanup or partial install Restore from media or backup Section 7
VBScript action runs, C action fails Language mismatch (expected) Confirm C action is required Section 8
Runtime stops, event log "DM_E_SYS_ERROR 0x10000000" DM API internal fault Inspect lower 24 bits, restart RT service Section 9.1
Runtime alarms "Connection to HMI data log interrupted" Time sync or SQL service issue Check NTP and SQL Server Express state Section 9.3, Siemens 109763475

13. Frequently Asked Questions

What does the error "can not find #include file GlobalDefinitions.h" mean in WinCC Professional V13?

It means the WinCC C compiler cannot locate the RT Professional API umbrella header. Either the user added a manual #include "GlobalDefinitions.h" line, the WinCC RT Professional runtime is not installed, or the file has been removed from C:\Program Files\Siemens\Automation\WinCC RT Professional\Apilib\.

Do I really need the GlobalDefinitions.h header in a simple C action?

No. The header is only required when the action calls WinCC RT Professional API functions such as Data Management (DM_xxx) or Tag and Logging (TLG_xxx). For pure VBScript, math, or screen logic the header is unnecessary and should be removed.

Can I just copy GlobalDefinitions.h from another PC running TIA Portal V13?

Yes, as a temporary workaround. Copy the file to the same Apilib folder on the failing engineering station and recompile. For a permanent fix, modify the TIA Portal installation and add the WinCC RT Professional component so the include path is registered.

Why does my VBScript action work while the C action fails with the same error?

VBScript uses the Windows Script Host and does not honor C #include directives. Only ANSI-C actions and global C functions are affected by missing GlobalDefinitions.h.

Where can I find the official list of RT Professional API error codes?

The complete error list for the Data Management and Tag & Logging API is published in the Siemens TIA Portal documentation portal under Runtime API → RT Professional → Error messages. See the linked pages in Section 9 of this article.

Back to blog