Ibavaresco / PCADSch2KiCAD

Program to convert ASCII P-CAD 2006 Schematics to KiCAD v8.0 format. It can also output P-CAD format with all the fields sorted.
Other
5 stars 1 forks source link

Any tips on how to build the software? #2

Closed danieljfarrell closed 1 month ago

danieljfarrell commented 1 month ago

Hello

Thanks for releasing this, it seems a very well put together project.

Do you have any tips for how you built the software on your system?

I am bit rusty with build tools, it's been a while, but I have done the following.

mkdir build-dir
cd build-dir
cmake ..
make

Perhaps the linker flags need defining?

As I get a few missing declaration type errors.

warning: implicit declaration of function ‘stricmp’; did you mean ‘strncmp’?
error: ‘LONG_MAX’ undeclared (first use in this function)

Here is the full output

Scanning dependencies of target PCADSch2KiCAD
[ 11%] Building C object CMakeFiles/PCADSch2KiCAD.dir/KiCADOutputSchematic.c.o
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c: In function ‘OutputAttribute’:
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:293:7: warning: implicit declaration of function ‘stricmp’; did you mean ‘strncmp’? [-Wimplicit-function-declaration]
  293 |   if( stricmp( NamePCAD, Attributes[i]->name ) == 0 )
      |       ^~~~~~~
      |       strncmp
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c: In function ‘FindTitleExtents’:
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:908:27: error: ‘LONG_MAX’ undeclared (first use in this function)
  908 |  pcad_dimmension_t Left = LONG_MAX, Right = LONG_MIN, Top = LONG_MIN, Bottom = LONG_MAX;
      |                           ^~~~~~~~
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:34:1: note: ‘LONG_MAX’ is defined in header ‘<limits.h>’; did you forget to ‘#include <limits.h>’?
   33 | #include "Parser.h"
  +++ |+#include <limits.h>
   34 | /*=============================================================================*/
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:908:27: note: each undeclared identifier is reported only once for each function it appears in
  908 |  pcad_dimmension_t Left = LONG_MAX, Right = LONG_MIN, Top = LONG_MIN, Bottom = LONG_MAX;
      |                           ^~~~~~~~
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:908:45: error: ‘LONG_MIN’ undeclared (first use in this function)
  908 |  pcad_dimmension_t Left = LONG_MAX, Right = LONG_MIN, Top = LONG_MIN, Bottom = LONG_MAX;
      |                                             ^~~~~~~~
/root/dev/PCADSch2KiCAD/KiCADOutputSchematic.c:908:45: note: ‘LONG_MIN’ is defined in header ‘<limits.h>’; did you forget to ‘#include <limits.h>’?
make[2]: *** [CMakeFiles/PCADSch2KiCAD.dir/build.make:63: CMakeFiles/PCADSch2KiCAD.dir/KiCADOutputSchematic.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/PCADSch2KiCAD.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

I know it's annoying explaining basic stuff to people on the internet, I appreciate you time and efforts!

I am building on linux, but could also build on Windows 11 or macOS.

Ibavaresco commented 1 month ago

Hi Daniel,

It seems that stricmp is not available in every library. It is available for GCC on Windows, but just a few days ago I learned that it doesn't work on Linux.

I just found this at https://www.ibm.com/docs/en/i/7.3?topic=functions-stricmp-compare-strings-without-case-sensitivity:

"Note: The stricmp() function is available for C++ programs. It is available for C only when the program defines the cplusplusstrings__ macro."

So:

define cplusplusstrings__

include

Or you can create your own version. That is what I did:

int stricmp( const char a, const char b ) { for( ; a != '\0' && b != '\0' && a == b; a++, b++ ) {} return a - b; }

‘LONG_MAX’ undeclared:

It seems that for Windows some header file includes what is needed, but you can just follow the tip of the compiler message:

include

Please let me know if these suggestions solve the problem or not.

Cheers, Isaac

danieljfarrell commented 1 month ago

Thanks Isaac,

That's helpful, I will try with GCC on Windows.

Regards,

Dan

Ibavaresco commented 3 weeks ago

Hi Daniel,

Did you have any success?

Cheers!

danieljfarrell commented 3 weeks ago

Yes I could build it really easily on Windows. Unfortunately I could not test it because I don't have any PCAD files and I can't get PCAD to install on Windows 11 ARM! Grrr.