Compile error
GoogleCodeExporter opened this issue · 3 comments
When attempting to compile V1.6, I recieve the following errors:
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\MyUsername>gcc C:\Users\MyUsername\Downloads\miditonesV1.6.c
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x11f9)
: undef
ined reference to `strlcpy'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x1215)
: undef
ined reference to `strlcat'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x1280)
: undef
ined reference to `strlcpy'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x129c)
: undef
ined reference to `strlcat'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x1416)
: undef
ined reference to `strlcpy'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x143d)
: undef
ined reference to `strlcat'
C:\Users\MyUsername\AppData\Local\Temp\cc2AY0Wr.o:miditonesV1.6.c:(.text+0x1474)
: undef
ined reference to `strlcat'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\J
im\AppData\Local\Temp\cc2AY0Wr.o: bad reloc address 0x20 in section `.data'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
C:\Users\MyUsername>g++ C:\Users\MyUsername\Downloads\miditonesV1.6.c
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'void
SayUsage(char*)':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
"" };
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c:105:18: warning: deprecated
conversion from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'void
chk_bufdata(unsigned c
har*, int)':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:206:68: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (ptr + len - buffer > buflen) midi_error("data missing", ptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'void
process_header()':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:241:34: error: invalid conversion
from 'i
nt8_t* {aka signed char*}' to 'char*' [-fpermissive]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:182:5: error: initializing
argument 1 o
f 'int charcmp(char*, char*)' [-fpermissive]
int charcmp (char *buf, char *match) {
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:241:34: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:241:72: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:250:43: error: expected ')'
before 'PRId3
2'
fprintf (logfile, "Header size %" PRId32 "\n", rev_long(hdr->header_siz
e));
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'void
start_track(int)':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:270:34: error: invalid conversion
from 'i
nt8_t* {aka signed char*}' to 'char*' [-fpermissive]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:182:5: error: initializing
argument 1 o
f 'int charcmp(char*, char*)' [-fpermissive]
int charcmp (char *buf, char *match) {
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:270:34: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:270:72: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'void
find_note(int)':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:353:67: error: expected ')'
before 'PRIx3
2'
if (logparse) fprintf(logfile, "SMPTE offset %08" PRIx32 "\n",
rev_long(*(unsigned long *)t->trkptr));
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:356:69: error: expected ')'
before 'PRIx3
2'
if (logparse) fprintf(logfile, "time signature %08" PRIx32 "\n"
, rev_long(*(unsigned long *)t->trkptr));
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:386:78: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
else if (event <0x80) midi_error("Unknown MIDI event type", t->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:440:61: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
midi_error("Unknown MIDI command", t->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c: In function 'int main(int,
char**)':
C:\Users\MyUsername\Downloads\miditonesV1.6.c:477:48: error: 'strlcpy' was not
declared
in this scope
strlcpy(filename, filebasename, MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:478:42: error: 'strlcat' was not
declared
in this scope
strlcat(filename, ".log", MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:488:44: error: 'strlcpy' was not
declared
in this scope
strlcpy(filename, filebasename, MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:489:38: error: 'strlcat' was not
declared
in this scope
strlcat(filename, ".mid", MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:548:71: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (num_tracks > MAX_TRACKS) midi_error ("Too many tracks", buffer);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:604:94: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (earliest_time < timenow) midi_error ("INTERNAL: time went backwards
", trk->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6.c:613:93: warning: deprecated
conversion fr
om string constant to 'char*' [-Wwrite-strings]
if (delta_msec > 0x7fff) midi_error ("INTERNAL: time delta too big"
, trk->trkptr);
^
C:\Users\MyUsername>g++ "C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c"
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'void
SayUsage(char*)':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
"" };
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:281:18: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'void
chk_bufdata(unsign
ed char*, int)':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:382:68: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (ptr + len - buffer > buflen) midi_error("data missing", ptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'void
process_header()':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:417:34: error: invalid
conversion fro
m 'int8_t* {aka signed char*}' to 'char*' [-fpermissive]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:358:5: error: initializing
argument
1 of 'int charcmp(char*, char*)' [-fpermissive]
int charcmp (char *buf, char *match) {
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:417:34: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:417:72: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MThd,"MThd")) midi_error("Missing 'MThd'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:426:43: error: expected ')'
before 'P
RId32'
fprintf (logfile, "Header size %" PRId32 "\n", rev_long(hdr->header_siz
e));
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'void
start_track(int)':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:446:34: error: invalid
conversion fro
m 'int8_t* {aka signed char*}' to 'char*' [-fpermissive]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:358:5: error: initializing
argument
1 of 'int charcmp(char*, char*)' [-fpermissive]
int charcmp (char *buf, char *match) {
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:446:34: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:446:72: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (!charcmp(hdr->MTrk,"MTrk")) midi_error("Missing 'MTrk'", hdrptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'void
find_note(int)':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:529:67: error: expected ')'
before 'P
RIx32'
if (logparse) fprintf(logfile, "SMPTE offset %08" PRIx32 "\n",
rev_long(*(unsigned long *)t->trkptr));
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:532:69: error: expected ')'
before 'P
RIx32'
if (logparse) fprintf(logfile, "time signature %08" PRIx32 "\n"
, rev_long(*(unsigned long *)t->trkptr));
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:562:78: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
else if (event <0x80) midi_error("Unknown MIDI event type", t->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:616:61: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
midi_error("Unknown MIDI command", t->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c: In function 'int main(int,
char**)':
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:654:48: error: 'strlcpy' was
not decl
ared in this scope
strlcpy(filename, filebasename, MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:655:42: error: 'strlcat' was
not decl
ared in this scope
strlcat(filename, ".log", MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:665:44: error: 'strlcpy' was
not decl
ared in this scope
strlcpy(filename, filebasename, MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:666:38: error: 'strlcat' was
not decl
ared in this scope
strlcat(filename, ".mid", MAXPATH);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:725:71: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (num_tracks > MAX_TRACKS) midi_error ("Too many tracks", buffer);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:781:94: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (earliest_time < timenow) midi_error ("INTERNAL: time went backwards
", trk->trkptr);
^
C:\Users\MyUsername\Downloads\miditonesV1.6 (1).c:790:93: warning: deprecated
conversio
n from string constant to 'char*' [-Wwrite-strings]
if (delta_msec > 0x7fff) midi_error ("INTERNAL: time delta too big"
, trk->trkptr);
^
Original issue reported on code.google.com by joeysfis...@gmail.com
on 24 Oct 2014 at 5:49
Is this library abandoned? Thanks
Original comment by q2d...@gmail.com
on 26 Mar 2015 at 4:38
- Added labels: ****
- Removed labels: ****
Sorry; for some reason github isn't notifying me of new issues.
The strlcpy and strlcat functions are safe BSD versions of strncpy and strncat.
See https://www.freebsd.org/cgi/man.cgi?query=strlcpy&sektion=3
I should probably include copies of the source for those.
PRId32 and PRIx32 should be in inttypes.h and were introduced in C99 as a way
to do implementation-independent format specifications.
The type conversion warnings and error seem to be coming from a compiler that is fussier
than the lcc-win compiler (http://www.cs.virginia.edu/~lcc-win32/) I'm using. I get no errors
or warnings from it.
Clearly there is some work needed to make this compile under Microsoft's recent compilers. I may not have the time to do that in the near future.
Ok, I downloaded the latest version of Microsoft Visual Studio 2013 and compiled both miditones and miditones_scroll with it. I incorporated source code for strlcpy and strlcat, and fixed up some type mismatch warnings. The only warnings left are about "possibly unsafe" standard functions, such as fopen. I don't get any warnings or errors about the PRld32 and PRlx32 constants. So I think the source code is pretty clean now.