0

In my program I needed to use some functions from Quantum lib. I work in windows, but for creating a .a file it needed to use bash. As a simplest way, I used wsl (windows subsystem for linux) and after that jast copy .a and .h files and work with them in my programm.

Prorgamm throws this errors:

C:\Projects\Cproject\QT\Mask\build-Mask-Desktop-Debug\..\Mask\processingBlock.cpp:351: error: undefined reference to `m3Quant(image_cc*)'
debug/processingBlock.o: In function `ZN15ProcessingBlock8analysisER6QMTIFFR8image_cci':
C:\Projects\Cproject\QT\Mask\build-Mask-Desktop-Debug/../Mask/processingBlock.cpp:351: undefined reference to `m3Quant(image_cc*)'
C:\Projects\Cproject\QT\Mask\build-Mask-Desktop-Debug\..\Mask\processingBlock.cpp:351: error: undefined reference to `m3euler26(image_cc*, long*)'
:-1: error: collect2.exe: error: ld returned 1 exit status

Are this errors conected with this metod of creating .a file?

  • I don't believe you can link a library created with linux with your windows application so creating it in WSL is not helping. – drescherjm May 08 '22 at 20:16
  • Maybe you know some other variants, how can I use this in my program? Maybe there is a way to convert it to a lib that will work? – Gorbatovsky May 08 '22 at 20:23
  • You probably want to install msys2 and build it in the mingw it provides. [https://www.msys2.org/](https://www.msys2.org/) – drescherjm May 08 '22 at 20:26
  • There is a sudo: command in .h file, that cannot be found by msys2. install.sh: line 7: sudo: command not found. Am I doing something incorrect? Or where this programm will save .a and .h files? – Gorbatovsky May 08 '22 at 21:16
  • Does this answer your question? [How to compile executable for Windows with GCC with Linux Subsystem?](https://stackoverflow.com/questions/38786014/how-to-compile-executable-for-windows-with-gcc-with-linux-subsystem) – NotTheDr01ds May 08 '22 at 21:49
  • @NotTheDr01ds Sorry but I still can't understand how to create .a file via bash .sh file that will correctly work in windows – Gorbatovsky May 08 '22 at 22:06
  • @Gorbatovsky You cannot. `.a` files are Linux/Unix static libraries. They do not work in Windows applications. You will need to cross-compile to Windows and output a `.lib` or `.dll.a` file instead. You should be able to use the resulting `.lib` in your Windows application. Also see [this](https://stackoverflow.com/q/6422478/11810933) and [this](https://stackoverflow.com/q/6421693/11810933). – NotTheDr01ds May 08 '22 at 22:14
  • What tools do we have to do this cross-compile? – Gorbatovsky May 08 '22 at 23:29

0 Answers0