create_nordic_project.py failed(1) when trying to add existing file in CMakeLists.txt

Hi,

I am trying add existing file in CMakeLists.txt a main.cpp file inside Project libapp.a, at which i am getting this python error.
Kindly help.

Regards,

Parents
  • Hello, 

    Can you please elaborate more on what you are trying to achieve? What version of the nRF Connect SDK are you using? What project are you trying to add this file to? Have you read the output error that is provided in the output of SES?

    -Øyvind

  • Hello ,

    I am just trying to add main.cpp in light_switch sample app, So to add that i have placed the file main.cpp in src folder, and i right click on project libapp.a and select "Add existing file to CmakeLists.txt" and select the main.cpp file.


    After which I am getting the error 

    create_nordic_project.py failed(1)

    Output error says:

    Creating solution light_switch.emProject
    D:/CHAMP2/Nordic_App/Nordic_SDK/nCS/v1.7.0/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=bl653_dvk -DBOARD_DIR=D:\CHAMP2\Nordic_App\Nordic_SDK\nCS\v1.7.0\zephyr\boards\arm\bl653_dvk -BD:\CHAMP2\Nordic_App\Nordic_SDK\nCS\v1.7.0\nrf\samples\bluetooth\mesh\light_switch\build_bl653_dvk -SD:\CHAMP2\Nordic_App\Nordic_SDK\nCS\v1.7.0\nrf\samples\bluetooth\mesh\light_switch -DNCS_TOOLCHAIN_VERSION=1.7.0 -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=D:\CHAMP2\Nordic_App\Nordic_SDK\nCS\v1.7.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
    -- Configuring incomplete, errors occurred!
    CMake Error at CMakeLists.txt:20:
    Parse error. Expected "(", got newline with text "

    ".



    error: cmake failed
    create_nordic_project.py failed (1)

    I also found that this has corrupted my light_switch sample app itself, because when I am trying to open light_switch sample app again from nRF Desktop app, it is running CMake and again generating create_nordic_project.py failed(1) error

     

  • Thanks for providing this information. 

    There have been issues with path length earlier, and the use of D:\ instead of C:\. Can you try the following:

    1. Shorten path to e.g. D:\NCS\v1.7.0.
    2. Move to C:\NCS\v1.7.0
    Ubaid_M said:
    -- Configuring incomplete, errors occurred!
    CMake Error at CMakeLists.txt:20:
    Parse error. Expected "(", got newline with text "

    ".

    Have you addressed this issue in the CmakeFile.txt on line 20?

  • Hi ,

    How do you mean to Shorten path to e.g. D:\NCS\v1.7.0...?
    I need SDK installed on the path that I am using right now.

    I haven't addressed this issue in the CmakeFile.txt on line 20..!!

    Can you kindly suggest how do address it.?

  • There have been issues with path length earlier

    Hi ,

    I think i got the issue, but i do not know why it is happening so

    In my CMakeLists.txt, before adding main.cpp in light_switch sample app,
    My CMakeLists.txt looks like this:

    Whereas, after i try to add main.cpp in light_switch sample app (Which I am unable to add as create_nordic_project.py failed (1) error pops up), my CMakeLists.txt looks like this after the error:

    Why is the CMakeLists.txt getting corrupted..?

    How can i solve this..?

  • Hello ,

    Is there any work around to this issue..?

  • How did you edit the CmakeLists.txt? Please fix CmakeLists.txt to the following

    # NORDIC SDK APP START
    target_sources(app PRIVATE
    	src/main.c
    	src/model_handler.c
    	src/main.cpp)
    target_include_directories(app PRIVATE include)
    
    # Preinitialization related to Thingy:53 DFU
    target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP app PRIVATE
      boards/thingy53.c
    )
    
    # NORDIC SDK APP END

    -Øyvind

Reply
  • How did you edit the CmakeLists.txt? Please fix CmakeLists.txt to the following

    # NORDIC SDK APP START
    target_sources(app PRIVATE
    	src/main.c
    	src/model_handler.c
    	src/main.cpp)
    target_include_directories(app PRIVATE include)
    
    # Preinitialization related to Thingy:53 DFU
    target_sources_ifdef(CONFIG_BOARD_THINGY53_NRF5340_CPUAPP app PRIVATE
      boards/thingy53.c
    )
    
    # NORDIC SDK APP END

    -Øyvind

Children
No Data
Related