vectorgrp / XCPlite

Simple implementation of the ASAM XCP on Ethernet protocol
MIT License
163 stars 88 forks source link

Compile xcpLite under WSL #7

Closed ayoubziat closed 2 years ago

ayoubziat commented 2 years ago

Hello,

I tried to compile the project under WSL, but got the following errors:

Error 1:

/mnt/~/XCPlite/xcpAppl.c: In function ‘vuint8 ApplXcpGetA2LFilename(char**, vuint32*, int)’:
/mnt/~/XCPlite/xcpAppl.c:230:29: error: invalid conversion from ‘vuint8*’ {aka ‘unsigned char*’} to ‘char*’ [-fpermissive]
  230 |         if (p != NULL) *p = (vuint8*)gA2LPathname;
      |                             ^~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             vuint8* {aka unsigned char*}
/mnt/~/XCPlite/xcpAppl.c:234:29: error: invalid conversion from ‘vuint8*’ {aka ‘unsigned char*’} to ‘char*’ [-fpermissive]
  234 |         if (p != NULL) *p = (vuint8*)gA2LFilename;
      |                             ^~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             vuint8* {aka unsigned char*}
make[2]: *** [CMakeFiles/xcpLite.dir/build.make:102: CMakeFiles/xcpLite.dir/xcpAppl.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xcpLite.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

Error2:

In file included from /mnt/~/XCPlite/util.c:12:
/mnt/~/XCPlite/util.h:104:1: error: expected declaration before ‘}’ token
  104 | }
      | ^
make[2]: *** [CMakeFiles/xcpLite.dir/build.make:141: CMakeFiles/xcpLite.dir/util.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xcpLite.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

For the first Error I would propose the following fix: if (p != NULL) *p = (char*)gA2LPathname; if (p != NULL) *p = (char*)gA2LFilename;

For the second Error: (There is a wrong #endif that must be deleted or rather moved to the last of the line f the file):

#ifdef _LINUX

#include <termios.h>

extern int _getch();
extern int _kbhit();

#endif

//#endif // this can be removed

#ifdef __cplusplus
}  /* extern "C" */
#endif

#endif
RainerZ commented 2 years ago

Thanks

Version 4 has been significantly refactored. I have added the changes.

RainerZ commented 2 years ago

...