SYNEAC
I think this is a simple problem, but as a fresh new one I ve struggled at this riddle for hours now and still cant figure out anything.

I followed a dudes tutorial step by step, and it goes well. But when I constructing my own thing it become a

Error : IEC to C compiler returned 1
PLC code generation failed !

and

Error in ST/IL/SFC code generator :
No variable defined in "program0" POU
PLC code generation failed !

mess, even seems Ive redone what has shown in the video. Another interesting note: after once successfully compiled no matter how you change the original one its willing to do it(unless completely delete it and redo it), before that its either follow the instructions or fail situation to me.

the tutorial link: https://www.youtube.com/watch?v=IIACnK0h18M&ab_channel=Mechatronics
Reply 0 0
SYNEAC
Capture.png
Reply 0 0
SYNEAC
above is my current situation, i ve changed  almost everything at variable table and tested every individual thing on/off to see what effects it, and searched the forum but have found nothing(maybe because its too stupidly basic), maybe the next move is to compare step by step to that video and hopefully dont cause further confusion.
Reply 0 0
SYNEAC
ps: that program0 is a misclick, after deleting it still says that
Reply 0 0
SYNEAC
2022112002.png

by the way a previous customly built one looks like a bit more complicate nut some how magically worked. i think its because it firstly successfully compiled and it doesnt care about how you mess with it later
Reply 0 0
r2k-in-the-vortex
I think this program0 is not so much a misclick, but the code that it's actually attempting and failing to compile. Look under Res0, there should be a cyclic task there and a instance of your program running on that task, maybe it's instantiating that program0 not your program1.

Especially if you look at the working example instance path vs yours, working example says Config0.Res0.instance0 right under POU list. Your broken example though.... 
 
Reply 0 0
thiagoralves
You’ve messed up with the program or instance definition in your project. The easiest way to fix this is to create a new project from scratch. The editor sets up the resources for you when you create a new project. Then you can just copy/paste the contents of your previous broken program into your new one.
Reply 0 0
SYNEAC
You’ve messed up with the program or instance definition in your project. The easiest way to fix this is to create a new project from scratch. The editor sets up the resources for you when you create a new project. Then you can just copy/paste the contents of your previous broken program into your new one.


Thank you very much, it actually is this easy, could you please give some idea why this definition thing happens, in case I somehow could learn and prevent all the nonsense
Reply 0 0
thiagoralves
I have no idea what you did, because I don't have your project file, but I believe you might have accidentally deleted an instance on resources or something like that.
Reply 0 0
Reply