Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error in MinGW #4

Open
llamafilm opened this issue Dec 11, 2020 · 1 comment
Open

Compile error in MinGW #4

llamafilm opened this issue Dec 11, 2020 · 1 comment

Comments

@llamafilm
Copy link

I tried to compile this on Windows in MinGW and got the below errors. I know very little about MinGW and Windows build environments in general, but I found that it works after simply renaming MAX() to max() in two places. I have no idea why this worked. I was using the latest master 53c8b71.

$ make
make  all-am
make[1]: Entering directory '/trunk/build/nv-video-info'
ccache gcc -DHAVE_CONFIG_H -I.   -D_FORTIFY_SOURCE=0 -D__USE_MINGW_ANSI_STDIO=1  -Werror -Wall -mthreads -mtune=generic -O2 -pipe -MT nvdecinfo-nvdecinfo.o -MD -MP -MF .deps/nvdecinfo-nvdecinfo.Tpo -c -o nvdecinfo-nvdecinfo.o `test -f 'nvdecinfo.c' || echo './'`nvdecinfo.c
mv -f .deps/nvdecinfo-nvdecinfo.Tpo .deps/nvdecinfo-nvdecinfo.Po
ccache gcc  -Werror -Wall -mthreads -mtune=generic -O2 -pipe  -pipe -static-libgcc -static-libstdc++ -o nvdecinfo.exe nvdecinfo-nvdecinfo.o  -ldl
ccache gcc -DHAVE_CONFIG_H -I.   -D_FORTIFY_SOURCE=0 -D__USE_MINGW_ANSI_STDIO=1  -mthreads -mtune=generic -O2 -pipe -MT nvencinfo-nvencinfo.o -MD -MP -MF .deps/nvencinfo-nvencinfo.Tpo -c -o nvencinfo-nvencinfo.o `test -f 'nvencinfo.c' || echo './'`nvencinfo.c
nvencinfo.c:232:3: warning: 'NV_ENC_PRESET_DEFAULT_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  232 |   { &NV_ENC_PRESET_DEFAULT_GUID,             "default" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:206:37: note: declared here
  206 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_DEFAULT_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:233:3: warning: 'NV_ENC_PRESET_HP_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  233 |   { &NV_ENC_PRESET_HP_GUID,                  "hp"},
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:210:37: note: declared here
  210 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HP_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:234:3: warning: 'NV_ENC_PRESET_HQ_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  234 |   { &NV_ENC_PRESET_HQ_GUID,                  "hq"},
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:214:37: note: declared here
  214 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_HQ_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:235:3: warning: 'NV_ENC_PRESET_BD_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  235 |   { &NV_ENC_PRESET_BD_GUID,                  "bluray"},
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:218:37: note: declared here
  218 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_BD_GUID  =
      |                                     ^~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:236:3: warning: 'NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  236 |   { &NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID, "ll" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:222:37: note: declared here
  222 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID  =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:237:3: warning: 'NV_ENC_PRESET_LOW_LATENCY_HQ_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  237 |   { &NV_ENC_PRESET_LOW_LATENCY_HQ_GUID,      "llhq" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:226:37: note: declared here
  226 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID  =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:238:3: warning: 'NV_ENC_PRESET_LOW_LATENCY_HP_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  238 |   { &NV_ENC_PRESET_LOW_LATENCY_HP_GUID,      "llhp" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:230:37: note: declared here
  230 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:239:3: warning: 'NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  239 |   { &NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID,    "lossless" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:234:37: note: declared here
  234 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c:240:3: warning: 'NV_ENC_PRESET_LOSSLESS_HP_GUID' is deprecated: WILL BE REMOVED IN A FUTURE VIDEO CODEC SDK VERSION [-Wdeprecated-declarations]
  240 |   { &NV_ENC_PRESET_LOSSLESS_HP_GUID,         "losslesshp" },
      |   ^
In file included from D:/temp/media-autobuild_suite/local64/include/ffnvcodec/dynlink_loader.h:35,
                 from nvencinfo.c:24:
D:/temp/media-autobuild_suite/local64/include/ffnvcodec/nvEncodeAPI.h:238:37: note: declared here
  238 | NV_ENC_DEPRECATED static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID =
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nvencinfo.c: In function 'print_profiles':
nvencinfo.c:396:18: warning: implicit declaration of function 'MAX' [-Wimplicit-function-declaration]
  396 |   uint32_t max = MAX(profileCount[0], profileCount[1]);
      |                  ^~~
mv -f .deps/nvencinfo-nvencinfo.Tpo .deps/nvencinfo-nvencinfo.Po
ccache gcc  -mthreads -mtune=generic -O2 -pipe  -pipe -static-libgcc -static-libstdc++ -o nvencinfo.exe nvencinfo-nvencinfo.o  -ldl
D:/temp/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: nvencinfo-nvencinfo.o:nvencinfo.c:(.text.startup+0x1005): undefined reference to `MAX'
D:/temp/media-autobuild_suite/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: nvencinfo-nvencinfo.o:nvencinfo.c:(.text.startup+0x1255): undefined reference to `MAX'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:404: nvencinfo.exe] Error 1
make[1]: Leaving directory '/trunk/build/nv-video-info'
make: *** [Makefile:303: all] Error 2
@gSegond
Copy link

gSegond commented Feb 15, 2021

Hi llamafilm,
It looks like a well known issue with windows.h redefining its own MIN and MAX macros.
You can try #define NOMINMAX before including windows.h, including dynlink_loader.h before windows.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants