CPCWiki forum

General Category => Applications (CPC and CPC-related) => Topic started by: CPCBEGIN on 00:31, 17 November 19

Title: no$cart can be compiled in GNU/Linux?
Post by: CPCBEGIN on 00:31, 17 November 19
I try to compile no$cart in Ubuntu Mate 18.04 64 bits using the commands:sudo apt install pasmo build-essential cmakecd srcmake
but I get this error:main.cpp:76:7: error: declaration of 'XPDB <unnamed struct>::XPDB' [-fpermissive]
  XPDB XPDB;
       ^~~~
main.cpp:66:3: error: changes meaning of 'XPDB' from 'typedef struct XPDB XPDB' [-fpermissive]
} XPDB;
   ^~~~
main.cpp: In function 'int main(int, const char**)':
main.cpp:933:87: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
         printf("Using Binary File '%s' length %d\n", pBinaryFilename, BinaryFileLength);
                                                                                       ^
main.cpp:1091:112: warning: format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Wformat=]
        fprintf(stderr, "Binary file is too large to write to cartridge. %d bytes remaining\n", BinaryFileLength);
                                                                                                                ^
<integrado>: recipe for target 'main.o' failed

Is there a way to compile this tool successfully in GNU/Linux.
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: megachur on 07:59, 17 November 19
replace the %d with

%ld

cf https://stackoverflow.com/questions/38561/what-is-the-argument-for-printf-that-formats-a-long (https://stackoverflow.com/questions/38561/what-is-the-argument-for-printf-that-formats-a-long)
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: CPCBEGIN on 13:10, 17 November 19
I change %d to %ld in main.cpp but I still get the same errors and much more (https://pastebin.com/Ee9J8gUX).
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: robcfg on 14:16, 17 November 19
Where can I download the no$cart source code?
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: robcfg on 14:42, 17 November 19
Ok, got it, saw the problems, and compiled it on Linux Mint.
So, you only had to change %d to %ld on lines 933 and 1091. The rest are ok.
The other problem comes from having a variable name (XPDB), that is the same name of a structure definition.I changed all XPDB  var names to Xpdb, and it compiles just fine.
Find attached the fixed main.cpp file.
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: CPCBEGIN on 15:24, 17 November 19
I download latest version from this wiki (http://www.cpcwiki.eu/index.php/Nocart) than includes a folder with the source code.
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: robcfg on 15:48, 17 November 19
Yes, I downloaded the latest version, 1.9 I think, and fixed it.


Just overwrite main.cpp with the one I uploaded in my previous post.
Title: Re: no$cart can be compiled in GNU/Linux?
Post by: CPCBEGIN on 16:35, 17 November 19
Thanks, I compile it successfully  8)
Powered by SMFPacks Menu Editor Mod