Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

References from IoStandard lib not found when using python script

vcbz
2021-10-12
2021-11-22
  • vcbz - 2021-10-12

    As part of my build I am testing the scriptengine. As a first test I am trying to compile a template project from the project wizard for a WinControlV3 device. When I build the project from the same machine I generated the project I dont have a problem.

    Script

    # encoding:utf-8
    from __future__ import print_function
    
    import argparse
    import os
    
    parser = argparse.ArgumentParser()
    parser.add_argument("project", help="Path to Codesys Project")
    args = vars(parser.parse_args())
    
    if not os.path.isfile(args["project"]):
        raise ValueError(args["project"]+ ' is not a file!')
    
    proj=projects.open(args["project"])
    application = proj.active_application
    application.generate_code()
    proj.close()
    

    However, in my build server with CODESYS v3.5.16.0 I run the same script and I get the following:

    Build: Text: C0: ------ Build started: Application: Device.Application -------
    Build: Text: C0: Typify code...
    Build: Warning: C100: Library BreakpointLogging has not been added to the Library Manager, or no valid license could be found
    Build: Error: C46: Identifier 'IoMgrReadInputs' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'IoMgrReadInputs'
    Build: Error: C46: Identifier 'IoMgrWriteOutputs' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'IoMgrWriteOutputs'
    Build: Error: C46: Identifier 'IoMgrUpdateConfiguration' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'IoMgrUpdateConfiguration'
    Build: Error: C46: Identifier 'IoMgrUpdateMapping' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'IoMgrUpdateMapping'
    Build: Error: C46: Identifier 'IoMgrUpdateConfiguration' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'IoMgrUpdateConfiguration'
    

    Both development and build computer have CODESYS v3.5 SP16 (3.5.16.0) installed. What I also noticed is that the libraries are not detected correctly if I create the project directly from the project Wizard. I have to delete the library manager,create it again and add the libraries IoStandard, Standard and CAA Device Diagnosis otherwise I get the following error before the last one I mentioned above:

    Build: Text: C0: ------ Build started: Application: Device.Application -------
    Build: Text: C0: Typify code...
    Build: Warning: C100: Library Standard has not been added to the Library Manager, or no valid license could be found
    Build: Warning: C100: Library BreakpointLogging has not been added to the Library Manager, or no valid license could be found
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat('License for ', strComponent)'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat(str, ' not installed.')'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat('Demo mode for ', strComponent)'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat(str, ' expired. Feature stopped!')'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'CONCAT('L', myUDINT_TO_STRING(udi := udi))'' to type 'STRING'
    Build: Error: C46: Identifier 'CONCAT' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'CONCAT'
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat('Demo mode for ', strComponent)'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'concat(str, ' started. Will expire and stop!')'' to type 'STRING'
    Build: Error: C46: Identifier 'concat' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'concat'
    Build: Error: C32: Cannot convert type 'Unknown type: 'len(str)'' to type 'INT'
    Build: Error: C46: Identifier 'len' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'len'
    Build: Error: C32: Cannot convert type 'Unknown type: 'LEN(str)'' to type 'INT'
    Build: Error: C46: Identifier 'LEN' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'LEN'
    Build: Error: C32: Cannot convert type 'Unknown type: 'FIND(str, '=')'' to type 'INT'
    Build: Error: C46: Identifier 'FIND' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'FIND'
    Build: Error: C231: Expression of type 'BOOL' expected in this place
    Build: Error: C77: Unknown type: 'left(str, (j - 1))'
    Build: Error: C46: Identifier 'left' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'left'
    Build: Error: C32: Cannot convert type 'Unknown type: 'MID(str, ((UINT_TO_INT(uiEndOfLine) - j) - INT#1), (j + INT#1))'' to type 'STRING'
    Build: Error: C46: Identifier 'MID' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'MID'
    Build: Error: C32: Cannot convert type 'Unknown type: 'right(str, (len(str) - UINT_TO_INT(uiEndOfLine)))'' to type 'STRING'
    Build: Error: C46: Identifier 'right' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'right'
    Build: Error: C77: Unknown type: 'len(str)'
    Build: Error: C46: Identifier 'len' not defined
    Build: Error: C35: Program name, function or function block instance expected instead of 'len'
    Build: Text: C0: Compile complete -- 43 errors, 2 warnings
    Build: Text: C0: Build complete -- 43 errors, 2 warnings : No download possible
    

    Any help or guidance on this issue is appreciated as I would expect that the project I create in another computer with the same software would be able to be opened and compiled but there seems to be something that I am missing. As I am not an expert on the Codesys Toolchain maybe someone who has more experience could shed some light on the matter.

     
  • vcbz - 2021-10-12

    Attached is the project sample

     
  • szsyo - 2021-11-22

    Hello. I am facing the same issue with "Error: C46: Identifier 'concat' not defined" in my code. @vcbz, Did you find a solution?

     

Log in to post a comment.