Paolo
Hello,
I just reinstalled Open PLC Runtime from the Windows installer freshly downloaded from autonomylogic.com but I have a problem
 
cat: ethercat: No such file or directory
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Windows
Generating object files...
In file included from Config0.c:6:
./lib/iec_std_lib.h:287:3: error: conflicting declaration ‘typedef struct tm tm’
  287 | } tm;
      |   ^~
In file included from /usr/include/sys/time.h:414,
                 from ./lib/iec_std_lib.h:60:
/usr/include/time.h:37:8: note: previous declaration as ‘struct tm’
   37 | struct tm
      |        ^~
./lib/iec_std_lib.h: In function ‘tm convert_seconds_to_date_and_time(long int)’:
./lib/iec_std_lib.h:319:6: error: ‘struct tm’ has no member named ‘tm_day’; did you mean ‘tm_mday’?
  319 |   dt.tm_day = days - __mon_yday[__isleap(dt.tm_year)][dt.tm_mon - 1] + 1;
      |      ^~~~~~
      |      tm_mday
./lib/iec_std_lib.h: In function ‘STRING __date_to_string(DATE)’:
./lib/iec_std_lib.h:621:31: error: ‘struct tm’ has no member named ‘tm_day’; did you mean ‘tm_mday’?
  621 |              broken_down_time.tm_day);
      |                               ^~~~~~
      |                               tm_mday
./lib/iec_std_lib.h: In function ‘STRING __dt_to_string(DT)’:
./lib/iec_std_lib.h:660:35: error: ‘struct tm’ has no member named ‘tm_day’; did you mean ‘tm_mday’?
  660 |                  broken_down_time.tm_day,
      |                                   ^~~~~~
      |                                   tm_mday
./lib/iec_std_lib.h:668:35: error: ‘struct tm’ has no member named ‘tm_day’; did you mean ‘tm_mday’?
  668 |                  broken_down_time.tm_day,
      |                                   ^~~~~~
      |                                   tm_mday
Error compiling C files
Compilation finished with errors!
 
Reply 0 0
fg71
In the header you will find
typedef struct {
  int tm_sec;      /* Seconds.  [0-60] (1 leap second) */
  int tm_min;      /* Minutes.  [0-59] */
  int tm_hour;      /* Hours.  [0-23] */
  int tm_day;      /* Day.    [1-31] */
  int tm_mon;      /* Month.  [0-11] */
  int tm_year;      /* Year  */
} tm;
And this is the main problem I believe with your code
  1. ./lib/iec_std_lib.h:287:3: error: conflicting declaration ‘typedef struct tm tm’
  2.   287 | } tm;
There is a conflict declaration meaning:
If two functions with the same name are declared in the same scope, one of the declarations overrides the other without warning.
 
Check the headers
 
You have declare other tm struct that maybe look like this
struct tm {
   int tm_sec;         /* seconds,  range 0 to 59          */
   int tm_min;         /* minutes, range 0 to 59           */
   int tm_hour;        /* hours, range 0 to 23             */
   int tm_mday;        /* day of the month, range 1 to 31  */
   int tm_mon;         /* month, range 0 to 11             */
   int tm_year;        /* The number of years since 1900   */
   int tm_wday;        /* day of the week, range 0 to 6    */
   int tm_yday;        /* day in the year, range 0 to 365  */
   int tm_isdst;       /* daylight saving time             */  
};
And it overide the stcruct in header iec_std_lib.h
Reply 0 0
thiagoralves
What platform are you trying to compile this to?
Reply 0 0
Paolo
It's on my Windows 10 64bits. With the blank hardware layer
Reply 0 0
mjaliyon
My problem also exactly same
Reply 0 0
fg71
There is 2 struct (tm) with the same name in your code.
I do not use OpenPLC Runtime on Windows platform, I use Linux.
Reply 0 0
mjaliyon
There is 2 struct (tm) with the same name in your code.
I do not use OpenPLC Runtime on Windows platform, I use Linux.
Could you please explain how to resolve it
Thanks
Reply 0 0
fg71
Rename all tm_day to tm_mday in the source code maybe fix it
Reply 0 0
thiagoralves
Reply 1 0
Reply