# Linking error with exit code 2 CMake opencv embarcadero C++ builder 10.3

**URL:** <https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484>\
**Category:** Uncategorized\
**Tags:** cmake, embarcadero, borland, build\
**Created:** [June 12, 2023, 2:00pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484 "2023-06-12T14:00:52Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 12, 2023, 2:00pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/1 "2023-06-12T14:00:52Z")

</div>

I need to use OpenCV in embarcadero C++ builder 10.3 and to do that I use CMake and the following command to create the borland makefiles:

```auto
cmake -DCMAKE_C_COMPILER=bcc32x.exe -DCMAKE_CXX_COMPILER=bcc32x.exe -DCMAKE_CXX_FLAGS="-Wno-c++11-narrowing" -G"Borland Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_OPENEXR=OFF -DBUILD_opencv_world=OFF -DBUILD_PERF_TESTS=OFF -DWITH_WEBP=OFF -DWITH_OPENCL=OFF -DWITH_FFMPEG=OFF -DWITH_OPENEXR=OFF -DWITH_TIFF=OFF -DBUILD_opencv_objdetect=OFF -DBUILD_TIFF=OFF -DBUILD_TESTS=OFF -DWITH_JASPER=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_PROTOBUF=OFF -DBUILD_opencv_dnn=OFF -DBUILD_IPP=OFF -DWITH_IPP=OFF -DWITH_ADE=OFF C:/openCV/opencv-4.5.3

```

After it finished building and generating I used the command **make install** to create the makefiles but I get an error when it tries to link saying:

```auto
[97%] Linking CXX executable ..\..\bin\opencv_annotationd.exe
Embarcadero C++ 7.40 for Win32 Copyright (c) 2012-2018 Embarcadero Technologies, Inc.
Embarcadero Technologies Inc. bcc32x version 5.0.2 (36752.0cce431.9f79754) (based on LLVM 5.0.2)
Target: i686-pc-windows-omf
Thread model: posix
InstalledDir: C:\Program Files (x86)\Embarcadero\Studio\20.0\bin
bcc32x.exe: warning: argument unused during compilation: '-nobuiltininc' [-Wunused-command-line-argument]
 "\"C:\\Program Files (x86)\\Embarcadero\\Studio\\20.0\\bin\\ilink32.exe\"" "@\"C:\\Users\\xanderv\\AppData\\Local\\Temp\\opencv_annotationd-63732a.cfg\""
Turbo Incremental Link 6.90 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Fatal: Unable to open file '....LIBOPENCV_CORE453D.LIB'
bcc32x.exe: error: linker command failed with exit code 2 (use -Xdriver -v to see invocation)

**error 2** deleting bin\opencv_annotationd.exe

**error 1** deleting apps\annotation\CMakeFiles\opencv_annotation.dir\all

**error 1** deleting all

```

I always get that error when trying to use the make install command and when trying to search if it is on my computer, it can’t be found anywhere. I don’t get the error when I use the ninja command like it is explained [here](https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Using_CMake_with_C%2B%2B_Builder). But when using ninja I don’t get it working like I explained in [this problem](https://stackoverflow.com/questions/76423476/linking-error-when-using-opencv-code-in-c-builder-10-3).  
This error occurs every time it wants to link exe files. How can I fix this error?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 12, 2023, 2:09pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/2 "2023-06-12T14:09:27Z")

</div>

> [@Xander-Vreeswijk](#):
>
> `LIBOPENCV_CORE453D.LIB`

that’s a lib build by MSVisual Studio, unusable with your compiler. how did it get there ?

> [@Xander-Vreeswijk](#):
>
> `opencv_annotationd.exe`

you probably don’t need it (for now).  
try to disable APPS with

```
cmake -DBUILD_opencv_apps=OFF

```

> [@Xander-Vreeswijk](#):
>
> `Embarcadero C++ 7.40 for Win32`

NO PERSON EVER MANAGED TO USE THIS SUCCESSFULLY  
(can we talk you out of using it ? 32bits, srsly ?)

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 14, 2023, 1:39pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/3 "2023-06-14T13:39:59Z")

</div>

Thanks for the reply, after adding _-DBUILD\_opencv\_apps=OFF_ it built correctly in the build folder. From the build folder I added the lib folder to _tools-\>options-\>Language-\>C++ Options-\>Paths and Directories-\>Library Path_. In _…-\>Paths and Directories-\>System Include Path_ I added the install folder of the build folder and the include of that install folder. After that I added all the lib files from the staticlib folder of the install folder to the project folder of the project I want to test. But when I want to test if I can use OpenCV by using a simple line of code _Mat frame;_ I get the following error:

```auto
[ilink32 Error] Error: Unresolved external 'cv::Mat::Mat()' referenced from C:\USERS\XANDERV\DOCUMENTS\GIT\APPLICATION SOFTWARE\OPENCVTEST\WIN32\DEBUG\MAIN.OBJ
[ilink32 Error] Error: Unresolved external 'cv::Mat::{1173}...' referenced from C:\USERS\XANDERV\DOCUMENTS\GIT\APPLICATION SOFTWARE\OPENCVTEST\WIN32\DEBUG\MAIN.OBJ
[ilink32 Error] Error: Unable to perform link

```

Sadly the project I need to add OpenCv to is created in WIN32 and want to see if it can be possible to be added for WIN32. Is the error because I use WIN32 or did I not correctly add the lib files to the project?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 14, 2023, 1:51pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/4 "2023-06-14T13:51:57Z")

</div>

congratulations !  
you got _way_ further than the other dozen or so ppl trying before !

> [@Xander-Vreeswijk](#):
>
> `Unresolved external 'cv::Mat::Mat()'`

opencv\_core missing somehow somewhere.  
there is probably a (generated) linker cmdline, can you show it ?  
if you’re linking _static_ libs, **order matters** , so everything _depending_ on core should go _before_ that with linking (else you get unexplainable errors like above !)

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 14, 2023, 1:59pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/5 "2023-06-14T13:59:01Z")

</div>

> [@berak](#):
>
> there is probably a (generated) linker cmdline, can you show it ?

This is the text that is under the ilink32 command line:

```auto
  c:\program files (x86)\embarcadero\studio\20.0\bin\ilink32.exe -G8 -L.\Win32\Debug;"c:\program files (x86)\embarcadero\studio\20.0\lib\Win32\debug";
  "C:\OpenCV\opencv-4.7.0\build\install\staticlib";"..\..\..\GIT\Application Software\OpenCVTest";"C:\OpenCV\opencv-XE7\build\lib";
  "C:\OpenCV\opencv-XE7\build\bin";"c:\program files (x86)\embarcadero\studio\20.0\lib\win32c\release";"c:\program files 
  (x86)\embarcadero\studio\20.0\lib\win32\release";"c:\program files (x86)\embarcadero\studio\20.0\lib\win32\release\psdk";"C:\Program Files 
  (x86)\DevExpress\VCL\Library\RS26";C:\Components\RVMediaVCL\Source;"C:\OpenCV\opencv-4.7.0\build\lib";
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\DCP -j.\Win32\Debug;"c:\program files (x86)\embarcadero\studio\20.0\lib\Win32\debug";
  "C:\OpenCV\opencv-4.7.0\build\install\staticlib";"..\..\..\GIT\Application Software\OpenCVTest";"C:\OpenCV\opencv-XE7\build\lib";
  "C:\OpenCV\opencv-XE7\build\bin";"c:\program files (x86)\embarcadero\studio\20.0\lib\win32c\release";"c:\program files 
  (x86)\embarcadero\studio\20.0\lib\win32\release";"c:\program files (x86)\embarcadero\studio\20.0\lib\win32\release\psdk";"C:\Program Files 
  (x86)\DevExpress\VCL\Library\RS26";C:\Components\RVMediaVCL\Source;"C:\OpenCV\opencv-4.7.0\build\lib";
  C:\Users\Public\Documents\Embarcadero\Studio\20.0\DCP -l.\Win32\Debug -v -Gn 
  -GA"C:\Users\xanderv\AppData\Local\Temp\vfs11C8.tmp"="C:\Users\xanderv\Documents\GIT\Application Software\OpenCVTest\Main.dfm" -aa -V5.0 -Tpe c0w32w 
  rtl.bpi vcl.bpi memmgr.lib sysinit.obj .\Win32\Debug\OpenCVTest.obj .\Win32\Debug\Main.obj , .\Win32\Debug\OpenCVTest.exe , 
  .\Win32\Debug\OpenCVTest.map , ittnotifyd.lib "libjpeg-turbod.lib" libopenjp2d.lib libpngd.lib opencv_aruco470d.lib opencv_bgsegm470d.lib 
  opencv_bioinspired470d.lib opencv_calib3d470d.lib opencv_ccalib470d.lib opencv_core470d.lib opencv_datasets470d.lib opencv_dpm470d.lib 
  opencv_face470d.lib opencv_features2d470d.lib opencv_flann470d.lib opencv_fuzzy470d.lib opencv_hfs470d.lib opencv_highgui470d.lib 
  opencv_imgcodecs470d.lib opencv_imgproc470d.lib opencv_img_hash470d.lib opencv_intensity_transform470d.lib opencv_line_descriptor470d.lib 
  opencv_ml470d.lib opencv_objdetect470d.lib opencv_optflow470d.lib opencv_phase_unwrapping470d.lib opencv_photo470d.lib opencv_plot470d.lib 
  opencv_quality470d.lib opencv_rapid470d.lib opencv_reg470d.lib opencv_rgbd470d.lib opencv_saliency470d.lib opencv_shape470d.lib opencv_stereo470d.lib 
  opencv_stitching470d.lib opencv_structured_light470d.lib opencv_superres470d.lib opencv_surface_matching470d.lib opencv_tracking470d.lib 
  opencv_video470d.lib opencv_videoio470d.lib opencv_videostab470d.lib opencv_xfeatures2d470d.lib opencv_ximgproc470d.lib opencv_xobjdetect470d.lib 
  opencv_xphoto470d.lib quircd.lib zlibd.lib import32.lib cp32mti.lib , , OpenCVTest.res 

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 14, 2023, 2:05pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/6 "2023-06-14T14:05:47Z")

</div>

any chance you can reorder this ?

- put ALL 3rdparty libs (ittnotify, png, jpg, zlib, …) to the back
- reorder opencv\_XXX libs, so that part ends with `opencv_imgproc470d.lib opencv_core470d.lib`

gl, report back, please !

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 16, 2023, 10:35am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/7 "2023-06-16T10:35:31Z")

</div>

I have tried to reorder the libraries but I have not yet found a way to do that. It keeps ordering it alphabetically so I thought to create the opencv\_world.lib file and try if that would work. To do that I added to the CMake command:

```auto
-DBUILD_opencv_world=ON

```

After generating and buidling the files and running make install I get the following error when it tries to link the opencv\_world library:

```auto
Error: the combinations '+*' or '*+' are not allowed

```

Along with a lot of warnings that looks like this:

```auto
Warning: duplicate file 'rc' in list, not added!
Warning: unknown command line switch 'o' ignored

```

Do I need to add something to the CMake command or is it not possible for borland makefiles?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 16, 2023, 10:37am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/8 "2023-06-16T10:37:09Z")

</div>

> [@Xander-Vreeswijk](#):
>
> `opencv_world`

yea, makes a lot of sense

> [@Xander-Vreeswijk](#):
>
> Do I need to add something to the CMake command or is it not possible for borland makefiles?

sorry, i have no idea

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 21, 2023, 8:23am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/9 "2023-06-21T08:23:45Z")

</div>

Sadly I can’t get it working for 32 bit so changed it to 64 bit. I used the following command to build the MakeFiles:

> cmake -DCMAKE\_C\_COMPILER=bcc64.exe -DCMAKE\_CXX\_COMPILER=bcc64.exe -DCMAKE\_CXX\_FLAGS=“-Wno-c++11-narrowing” -G"Borland Makefiles" -DCMAKE\_BUILD\_TYPE=Debug -DBUILD\_PERF\_TESTS=OFF -DWITH\_WEBP=OFF -DWITH\_OPENEXR=OFF -DWITH\_TIFF=OFF -DBUILD\_TIFF=OFF -DBUILD\_TESTS=OFF -DWITH\_JASPER=OFF -DBUILD\_SHARED\_LIBS=OFF -DBUILD\_PROTOBUF=OFF -DBUILD\_opencv\_dnn=OFF -DBUILD\_IPP=OFF -DWITH\_IPP=OFF -DWITH\_ADE=OFF -DBUILD\_opencv\_apps=OFF C:\openCV\opencv-4.7.0

But when I run make install I get the following error when it tries to link opencv\_core:

> Error: unable to read ‘CMakeFiles.o’
> 
> \*\* error 1 \*\* deleting lib\opencv\_core470d.lib
> 
> \*\* error 1 \*\* deleting modules\core\CMakeFiles\opencv\_core.dir\all
> 
> \*\* error 1 \*\* deleting all

It has the same kind of warnings as when I try to use opencv\_world in 32 bit. How can I solve this problem?

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 21, 2023, 11:37am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/10 "2023-06-21T11:37:52Z")

</div>

> [@Xander-Vreeswijk](#):
>
> Thanks for the reply, after adding _-DBUILD\_opencv\_apps=OFF_ it built correctly in the build folder. From the build folder I added the lib folder to _tools-\>options-\>Language-\>C++ Options-\>Paths and Directories-\>Library Path_. In _…-\>Paths and Directories-\>System Include Path_ I added the install folder of the build folder and the include of that install folder. After that I added all the lib files from the staticlib folder of the install folder to the project folder of the project I want to test. But when I want to test if I can use OpenCV by using a simple line of code _Mat frame;_ I get the following error:
> 
> ```auto
> [ilink32 Error] Error: Unresolved external 'cv::Mat::Mat()' referenced from C:\USERS\XANDERV\DOCUMENTS\GIT\APPLICATION SOFTWARE\OPENCVTEST\WIN32\DEBUG\MAIN.OBJ
> [ilink32 Error] Error: Unresolved external 'cv::Mat::{1173}...' referenced from C:\USERS\XANDERV\DOCUMENTS\GIT\APPLICATION SOFTWARE\OPENCVTEST\WIN32\DEBUG\MAIN.OBJ
> [ilink32 Error] Error: Unable to perform link
> 
> ```
> 
> Sadly the project I need to add OpenCv to is created in WIN32 and want to see if it can be possible to be added for WIN32. Is the error because I use WIN32 or did I not correctly add the lib files to the project?

I found out that I get this error because the lib file for opencv\_core is completely empty. Did I do something wrong with the CMake command or is there another problem?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [June 21, 2023, 3:50pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/11 "2023-06-21T15:50:30Z")

</div>

> [@Xander-Vreeswijk](#):
>
> Error: unable to read ‘CMakeFiles.o’

that looks sus.

anything named `CMakeFiles` is not compilable.

`.o` implies that either (1) the compiler was told to compile something of that name or (2) something expects that file to be compiled, which obviously makes no sense.

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 28, 2023, 8:06am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/12 "2023-06-28T08:06:33Z")

</div>

When trying to run opencv for embarcadero C++ builder 10.3 I changed a few things in the folder of OpenCV:

> error: use of undeclared identifier ‘uintptr\_t’ = add #include in …\opencv-4.7.0\3rdparty\ittnotify\include\ittnotify.h
> 
> error: use of undeclared identifier ‘lrintf’ = add #include \<math.h\> in …/opencv-4.7.0/modules/core/include\opencv2/core/fast\_math.hpp
> 
> error: unknown type name ‘FILE’ = add #include \<stdio.h\> in …/opencv-4.7.0/modules/core/include\opencv2/core/operations.hpp
> 
> error: use of undeclared identifier ‘llvm’ = comment it out and make it return 0; instead in …/opencv-4.7.0/modules/core/include\opencv2/core/hal/intrin.hpp
> 
> error: token is not a valid binary operator in a preprocessor subexpression in #if (i64\_fromNaN != i64\_fromPosOverflow) || (i64\_fromNaN != i64\_fromNegOverflow) = comment out:  
> #if (i64\_fromNaN != i64\_fromPosOverflow) || (i64\_fromNaN != i64\_fromNegOverflow)  
> if ((exp == 0x7FF) && sig) {  
> #if (i64\_fromNaN == i64\_fromPosOverflow)  
> sign = 0;  
> #elif (i64\_fromNaN == i64\_fromNegOverflow)  
> sign = 1;  
> #else  
> raiseFlags(flag\_invalid);  
> return i64\_fromNaN;  
> #endif  
> }  
> #endif in …\opencv-4.7.0\modules\core\src\softfloat.cpp

My guess the reason why the core lib is empty is because of one of the changes I made to the files. I could solve three errors by adding an header to the code, but I don’t know how to solve the last two errors. The error messages from RAD studio prompt about the last two errors is shown below:  
**llvm:**

> [5%] Building CXX object modules/core/CMakeFiles/opencv\_core.dir/src/algorithm.cpp.obj  
> Embarcadero C++ 7.40 for Win32 Copyright (c) 2012-2018 Embarcadero Technologies, Inc.  
> C:\OpenCV\opencv-4.7.0\modules\core\src\algorithm.cpp:  
> In file included from C:\OpenCV\opencv-4.7.0\modules\core\src\algorithm.cpp:43:  
> In file included from C:\OpenCV\opencv-4.7.0\modules\core\src/precomp.hpp:88:  
> C:/OpenCV/opencv-4.7.0/modules/core/include\opencv2/core/hal/intrin.hpp:83:9: error: use of undeclared identifier ‘llvm’  
> return llvm.cttz.i32(value, true);  
> ^  
> 1 error generated.
> 
> \*\* error 1 \*\* deleting modules\core\CMakeFiles\opencv\_core.dir\src\algorithm.cpp.obj
> 
> \*\* error 1 \*\* deleting modules\core\CMakeFiles\opencv\_core.dir\all
> 
> \*\* error 1 \*\* deleting all

**i64\_fromNaN:**

> [14%] Building CXX object modules/core/CMakeFiles/opencv\_core.dir/src/softfloat.cpp.obj  
> Embarcadero C++ 7.40 for Win32 Copyright (c) 2012-2018 Embarcadero Technologies, Inc.  
> C:\OpenCV\opencv-4.7.0\modules\core\src\softfloat.cpp:  
> C:\OpenCV\opencv-4.7.0\modules\core\src\softfloat.cpp:2051:6: error: token is not a valid binary operator in a  
> preprocessor subexpression  
> #if (i64\_fromNaN != i64\_fromPosOverflow) || (i64\_fromNaN != i64\_fromNegOverflow)  
> ^ ~~~~~~~~~~  
> C:\OpenCV\opencv-4.7.0\modules\core\src\softfloat.cpp:327:40: note: expanded from macro ‘i64\_fromNaN’  
> #define i64\_fromNaN UINT64\_C( 0x7FFFFFFFFFFFFFFF )  
> ~~^~~~~~~~~~~~  
> C:/PROGRA~2/EMBARC~1/Studio/20.0/include/windows/crtl\stdint.h:211:33: note: expanded from macro ‘UINT64\_C’  
> #define UINT64\_C(x) ((uint64\_t) x)  
> ~~~~~~~~~~ ^  
> 1 error generated.
> 
> \*\* error 1 \*\* deleting modules\core\CMakeFiles\opencv\_core.dir\src\softfloat.cpp.obj
> 
> \*\* error 1 \*\* deleting modules\core\CMakeFiles\opencv\_core.dir\all
> 
> \*\* error 1 \*\* deleting all

What should I do to solve these errors and is commenting out the place where the error occurs the reason why my core lib is empty?

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [June 28, 2023, 10:38am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/13 "2023-06-28T10:38:09Z")

</div>

Another question about 64 bit, I downloaded the windows file from the site and got a .lib file of world. Except for Embarcadero C++ Builder 64 bit it needs to be .a file. Is there an easy way to change a lib file from .lib to .a?

I have tried lib2a but when I link the .a file I get the following error (object name may differ):

> [ilink64 Error] Fatal: Invalid object file ‘dkpit.o’

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [July 5, 2023, 9:23am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/14 "2023-07-05T09:23:47Z")

</div>

After downgrading my OpenCV version to 2.4.13 and running the CMake command adding that contrib and legacy need to be turned off I have successfully downloaded the OpenCV lib files and have added them to C++ builder. Using those lib files, I could create a Mat file where I read an image. But when I want to try imshow to show the image I get the error saying that “[bcc32c Error] Main.cpp(26): C++ requires a type specifier for all declarations”. How can I solve this error?

---

<div class="post-metadata">

**Author:** ![Acronis](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Acronis](https://forum.opencv.org/u/Acronis)\
**Post date:** [July 6, 2023, 12:02am UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/15 "2023-07-06T00:02:58Z")

</div>

> [@Xander-Vreeswijk](#):
>
> After downgrading my OpenCV version to 2.4.13 and running the CMake command adding that contrib and legacy need to be turned off I have successfully downloaded the OpenCV lib files and have added them to C++ builder. Using those lib files, I could create a Mat file where I read an image.

Hi. Can you share your C++ Builder project ?

---

<div class="post-metadata">

**Author:** ![Xander-Vreeswijk](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@Xander-Vreeswijk](https://forum.opencv.org/u/Xander-Vreeswijk)\
**Post date:** [July 7, 2023, 1:57pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/16 "2023-07-07T13:57:38Z")

</div>

Sorry, completely forgot to reply.  
I use 10.3 C++ Builder so maybe it is better to just try and build the lib files yourself. For me I used the mostly the same command as I used for 4.7.0 but I removed the extra modules. If you encounter any errors let me know and maybe I can help you.

---

<div class="post-metadata">

**Author:** ![Acronis](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Acronis](https://forum.opencv.org/u/Acronis)\
**Post date:** [July 9, 2023, 11:47pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/17 "2023-07-09T23:47:56Z")

</div>

> [@Xander-Vreeswijk](#):
>
> If you encounter any errors let me know and maybe I can help you.

Thanks.

I hope we will be able to integrate OpenCV into C++ Builder !

---

<div class="post-metadata">

**Author:** ![Pawel\_Witas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/pawel_witas/32/8809_2.png) [@Pawel\_Witas](https://forum.opencv.org/u/Pawel_Witas)\
**Post date:** [September 29, 2023, 12:24pm UTC](https://forum.opencv.org/t/linking-error-with-exit-code-2-cmake-opencv-embarcadero-c-builder-10-3/13484/18 "2023-09-29T12:24:15Z")

</div>

Hello

I also had this TLIB error while compiling cURL for C++ Builder using CMake

```auto
Error: the combinations '+*' or '*+' are not allowed

```

The reason was unexpected and trivial:  
File objects1.rsp generated by CMake contains the list of obj files required by the linker. Unfortunately the paths to these files have folders separated by / (unix style), not \ (windows style). When I replaced all chars / by \ in this file, libcurl.lib linked correctly.  
I hope it will help you compile your project.
