Unable to connect out-port of eclipse program with in-port of PLCnext C++ project (tasks & events)

Hello, I seem to be having trouble with finding the out-port of the eclipse program whose library I’ve imported into a PLCnext program. I’ve been following the you tube video titled “How to program C++ on a PLCnext control | C++ with PLCnext Technology” (url: https://www.youtube.com/watch?v=IUGSZzuzm-c&t;=61s). The part where I’m having trouble is at timestamp 4:52 of that video. Seen in the attached picture titled “my_version.jpg” is what I have versus “youtube_version.jpg” what the referenced Phoenix Contact youtube has. I also notice that when I created the new project with the single port on eclipse right out the gate, there’s a few errors as seen in the attached picture “new_project_errors.jpg”. I mention this as I wonder if it might have something to do with it even though all the other steps in the youtube video seem to check out well for me. Your help is very much appreciated!

Hi Brendan, That red highlighting on the source code isn’t a problem - Eclipse sometimes has trouble resolving references while editing, but if it compiles OK then it’s fine. The reason for the difference between your screen shot and the video, is that at 4:51 in the video I clicked on the “Port List” tab (below). If you do the same, you should see the same screen. Note that there might be some relatively minor differences, since the video was made about 1 year ago with earlier versions of PLCnext Engineer etc. Hope this helps! ~ Martin. 2020 01 13 193441

Hey Martin, I tried that too, and it comes with an error message saying “no connectable items available” as an error message at the bottom right hand of the corner.

OK, please check: 1. Have you defined the port in your IEC program, shown at around 4:30 in the video? 14 01 2020 7 57 03 2. Have you defined a Port variable in the C++ program header file, shown from about 1:50 in the video? 14 01 2020 8 00 26 If these two things are done, both these port variables should appear in the Data List window. ~ Martin.

Did these things - I attached depictions on what I have for both eclipse and PLCnext.


OK, so I am guessing that you can see myFirstIntVar from the IEC program, but not myFirstint from the C++ program in the Data List. The reason for this is that the port variables in the C++ program must be defined in a particular way, as described in the comment section and as shown in the screen shot below. Those comments that start with //# are not just any old comments - as part of the build process, the source files are parsed by our plcncli tool, and comments in this format are used to create other C++ source files, and XML metadata files. These additional files are necessary to create the ports on your C++ program. So, please try adding comments in the format shown below to your C++ port variable. 14 01 2020 8 00 26 ~ Martin.

Hey Martin, Thanks again, I got this part to work after I removed the old library where the port wasn’t configured as shown above (I had no idea those comments weren’t regular, inert comments, new learning for me). What I did to ultimately make it work was to remove the old library, start a new project, import the newly compiled library, and everything worked as far as that is concerned. Thanks again for your support and I’m glad we were able to close the loop.