Build VS 2015, Opencv 4.5.1 with cuda 11.0: LNK1210 exceeded internal ILK size limit(error only on debug mode)

Error only shows on Debug mode.

Severity Code Description Project File Line Suppression State
Error LNK1210 exceeded internal ILK size limit; link with /INCREMENTAL:NO opencv_world C:\Working\opencv-4.5.1\build\modules\world\LINK 1

Please give me a suggestion.


run cmake with -D BUILD_opencv_world=OFF (or find that key in cmake-gui)

that’ll link individual modules rather than one big world module.

or do what the error says, which is some configuration in the stated VS project.

Thanks, Because that is a part of my project, i need xxxx_wordyyy.lib for another project. Is there a way to overcome that instead of turning it off?

can you find the setting that’s mentioned in the error in the VS project settings?

I tried some ways but still get error, the error code is no longer existed on visual studio 2015 64bit.
Is there away to remove unused extra modules to get a smaller project?

yes, uncheck those you don’t want in cmake-gui. that’s the easiest method.

do they depend on each other ?

List of objects that we used on our project:


How do we address which modules they come ?

Or we could use another builder tool instead msbuilder

you’ll need

  • surely: core, highgui, videoio
  • maybe: imgproc, imgcodecs
  • make sure to keep WITH_OPENGL
  • cudaoptflow, cudastereo, not sure what else

I can’t say what you won’t need.

some modules might depend on each other. the cmake configuration step will tell you if anything conflicts.

run print(cv.getBuildInformation()) if you want to see the final report from the cmake configuration step. it lists the modules. example:

  OpenCV modules:
    To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab viz wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    gapi java_bindings_generator js_bindings_generator objc_bindings_generator python_tests world
    Disabled by dependency:      -
    Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv hdf java julia matlab ovis python2
    Applications:                apps
    Documentation:               NO
    Non-free algorithms:         YES

Thanks for your support,
One more thing, i dont know why no body here faced the issues or i did some thing wrong.

most people either

  • only build the main repository and no contrib code (cuda is contrib), then the world library’s size is manageable
  • don’t link everything into a world library but individual module libraries (opencv_core, opencv_highgui, …)

your other project doesn’t have to link against opencv_world. it can just as well link against the specific module libraries it actually uses. ppencv_world is a mere convenience. one might even say it’s for lazy people.

You meant that we should attach contrib modules into the project instead of putting them on opencv_world ?

no, I’m saying to set BUILD_opencv_world=OFF and then

in that project you do not link against opencv_world but against opencv_core and whatever other modules you actually use there.

or to set that configuration in VS that your error message told you to set.

you have a choice here. both ways work.

Thank you :slight_smile: