Log in

View Full Version : Error trying to compile x264


jpsdr
24th August 2013, 12:48
Hello.

I've just tried to compile the new release, but i have the following error :

output/mp4.c: In function 'open_file' :
output/mp4.c:189:24: error: 'MAX_PATH' undeclared (first use in this function)
output/mp4.c:189:24: note: each undeclared identifier is reported only once for each function it appears in
output/mp4.c:189:10: warning: unused variable 'ansi_filename' [-Wunused-variable]
make: *** [output/mp4.o] Error 1


So... help...

Kurtnoise
24th August 2013, 13:54
Here is a patch :

output/mp4.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/output/mp4.c b/output/mp4.c
index c6192a8..2325d37 100644
--- a/output/mp4.c
+++ b/output/mp4.c
@@ -36,6 +36,10 @@
#define realloc gf_realloc
#endif

+#ifndef MAX_PATH
+#define MAX_PATH (260)
+#endif
+
typedef struct
{
GF_ISOFile *p_file;

LoRd_MuldeR
24th August 2013, 15:16
The missing macro MAX_PATH is defined in <Windows.h>, so I would rather add the following:
#ifdef _WIN32
#include <windows.h>
#endif

While it's unlikely that MAX_PATH will ever be changed to something else than 260 (that value is pretty much meaningless anyway, as Windows supports much longer paths for more than a decade now!), this is the "correct" way. Also it is more consistent with what x264 does in all other places where MAX_PATH is used. Another "clean" solution, which avoids the inclusion of the Windows.h in mp4.c, would be defining a X264_MAX_PATH in common.h and use that one everywhere.

jpsdr
25th August 2013, 09:31
Thanks, i've used LoRd_MuldeR's patch.

LoRd_MuldeR
25th August 2013, 12:28
Thanks, i've used LoRd_MuldeR's patch.

It has been fixed in Git now, so no patch needed anymore:
http://git.videolan.org/?p=x264.git;a=commitdiff;h=e61d9f9d3d77584136a591e01cebecbd7547a43b;hp=a1d3d17239e94a82ab261a071384295406bd8587

jpsdr
25th August 2013, 13:56
Yes, i've noticed this.