Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. nazirlouis38
  2. PLCnext Technology & PLCnext Controls
  3. Tuesday, 08 June 2021
I'm writting a c++ program to run the plcnext controller and I want to know what is the best way to add a wait funtion. In the orginal code I used

#include <windows.h>

For a 20ms delay but when I moved the program into eclipse it shows an error message next to the include saying "unresolved conclusion" and then error next to Sleep(20); can I still build the program as it and it still work or do I need to use a different alternative?

Image of code is attached
Attachments (1)
Accepted Answer
Eduard PLCnext Team Accepted Answer Pending Moderation
Hello nazirlouis38,
I can see, that you included the Window API (windows.h) in your project. Please note, the Linux operating system is installed on the PLCnext Controller. You can use functions described in PLCnext C++ API documentation and standard C/C++ librarys.

Please delete the "#include <windows.h>" and replace the "Sleep(20);" with "sleep(20);"

Best Regards
Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support

There are replies in this post but you are not allowed to view the replies from this post.