Problems linking gsl 2.1 with Qt - c++

I'm using Qt 5.8 and gsl 2.1 (compiled with cygwin64). This is what I use in the .pro file to link gsl:
INCLUDEPATH+=C:/gsl/include/
INCLUDEPATH += C:/gsl/LIBS
LIBS += -LC:/gsl/lib -lgsl -lgslcblas -lm
When I include the headers and compile, I don't have any problem, even when I declare and object. But when I try to use any function I get this error:
C:\Users\CIFAS-1\untitled4\mainwindow.cpp:9: error: undefined reference to `gsl_matrix_alloc'.

I already solve the problem, I found a compiled version of gsl for mingw32 here https://code.google.com/archive/p/gsl-w32/downloads, it is another version but works great.

Related

How to link against Vulkan with MinGW and QMake?

I tried to link against Vulkan with:
LIBS += -L$$(VK_SDK_PATH)/Bin -lvulkan-1 # Doesn't work at all
LIBS += -L$$(VK_SDK_PATH)/Lib -lvulkan-1 # Works with MSVC
But I couldn't get it linking with MinGW.
INSTALLED:
VulkanSDK (1.2.148.1)
Qt (5.15.0; MSYS2)
MinGW (10.2.0; MSYS2)
I installed the Vulkan Runtime and retried
LIBS += -L$$(VK_SDK_PATH)/Lib -lvulkan-1
with MinGW again and it works. Nevertheless, thank you for helping me out.

Undefined reference to boost libraries in QT creator on Windows

I am trying to run a QT project on Windows that I have developed on Linux Ubuntu. Unfortunately, I cannot manage it to properly link the boost library. Here is a detailed description of the problem.
I downloaded MinGW from https://nuwen.net/mingw.html, version 13.5, such that the gcc version 5.3.0 matches the MinGW version of QT. The reason to choose this version of MinGW is that it contains the boost libraries for compression such as zlib. From the command line I compile and run my program without any problems:
g++ -std=c++11 -w -IC:/MinGW/include -LC:/MinGW/lib bAya.cpp A.o B.o C.o -o baya -lboost_iostreams -lz -lbz2
where A,B, C are my pre-compiled object files.
In QT creator I selected the MinGW compiler (C:\MinGW_53\MinGW\bin\g++.exe) and created a new default kit with the compiler.
My .pro file looks as follows:
MAKE_CXXFLAGS += -std=c++11
INCLUDEPATH += C:/MinGW_53/MinGW/include \
C:/Users/kuzk/Documents/src
LIBS += -LC:/MinGW_53/MinGW/lib/mylib \
-lboost_system \
-lboost_iostreams \
-lz \
-lbz2
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += main.cpp\
mainwindow.cpp \
../src/A.cpp \
../src/B.cpp \
../src/C.cpp
HEADERS += mainwindow.h \
../src/A.h \
../src/B.h \
../src/C.h
The folder C:/MinGW_53/MinGW/lib/mylib contains my .a files such as libboost_iostreams.a
When I build it, I get many undefined reference errors such as
error: undefined reference to `boost::iostreams::zlib::default_strategy'
Interestingly, if C:/MinGW_53/MinGW/lib/mylib contains also libstdc++.a I also get linking errors to std::cout, std::ifstream etc.
I am currently stuck and I will be very helpful for any feedback.
Best,
Konstantin
Adding the library path for boost_iostreams:
-LC:/MinGW/lib \
after the line:
LIBS += -LC:/MinGW_53/MinGW/lib/mylib \
should fix it.
At the end I was able to resolve the problem. Here is what I did. I am using QT 5.7 on Windows 10.
I compiled boost using QT's console as described here: http://cpp-qt-mac-win.blogspot.co.uk/2011/10/qt-boost-for-beginners-step-by-step.html
Then I created a new project and added the paths to boost and the necessary libraries, as described in my question.
An important note. I tried to update the paths in the existing project, by running qmake and then rebuilding the project. I was getting the very same errors as I was getting with the old paths to "standard" boost. Apparently, something was cached and the changes didn't do anything. However, if I give a wrong path to a library it complained. So, QT has very confusing behavior. If someone can explain it, it will be helpful.

What lib do I have to include in Makefile when using MFCreateSourceReaderFromByteStream?

I'm currently working on a AAC Decoder on Windows using Microsoft Media Foundation. I'm using the Source Reader and it's method MFCreateSourceReaderFromByteStream. When I compile I get following error:
undefined reference to `MFCreateSourceReaderFromByteStream#12'
This is how my Makefile looks like under LIBS:
LIBS = -lpthread -lFLAC-8 -lFLAC++-6 -lOpenAl32 -lm -lcurl-4 -lole32 -lmfplat
What other libs do I need to include?
Compiler used: mingw32 gcc
Thanks
The docs show clearly that you need to link to Mfreadwrite.lib

How do I integrate C++ Boost into a Qt project?

I would like to use boost/filesystem.hpp in my Qt app but the builder keeps saying:
Library not loaded: libboost_filesystem.dylib
Reason: image not found
here is how I try to link it:
INCLUDEPATH+= /installdir/boost_1_50_0
LIBS += -L/installdir/boost_1_50_0/stage/lib -lboost_filesystem
I've tried linking directly, too. I've also tried rebuilding boost according to jschoen's answer, no difference.
Im running a MacOSX Lion. How do I have to link boost properly?
In the meantime I have found a solution.
install boost with macports (sudo port install boost) Thanks to dies and Tim Cooper.
then link against:
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib
LIBS += -lboost_system-mt -lboost_filesystem-mt

Linking freeglut with Qt Creator in Linux

I currently run Arch Linux on my laptop and was hoping to know why Qt Creator isn't finding my glut library (which exists on my system).
My setup qmake file looks as follows:
...
/*sources and headers above*/
QT += opengl
LIBS += -lfreeglut
INCLUDEPATH += -L/usr/lib/
And when I run a locate glut, I get the following:
/usr/include/kwinglutils.h
/usr/include/kwinglutils_funcs.h
/usr/include/GL/freeglut.h
/usr/include/GL/freeglut_ext.h
/usr/include/GL/freeglut_std.h
/usr/include/GL/glut.h
/usr/lib/libglut.a
/usr/lib/libglut.so
/usr/lib/libglut.so.3
/usr/lib/libglut.so.3.9.0
/usr/share/avogadro/fragments/amino_acids/D-glutamic_acid.cml
/usr/share/avogadro/fragments/amino_acids/D-glutamine.cml
/usr/share/avogadro/fragments/amino_acids/L-glutamic_acid.cml
/usr/share/avogadro/fragments/amino_acids/L-glutamine.cml
/usr/share/licenses/freeglut
/usr/share/licenses/freeglut/LICENSE
/var/lib/pacman/local/freeglut-2.6.0-1
/var/lib/pacman/local/freeglut-2.6.0-1/changelog
/var/lib/pacman/local/freeglut-2.6.0-1/desc
/var/lib/pacman/local/freeglut-2.6.0-1/files
Note that I have tried -lglut32 in my qmake file as well.
What could I be missing here?
When you specify -lfoobar in your .pro file (or with gcc in general), you're directing the compiler to search for the library libfoobar.a. Judging from your locate output it looks like you want:
LIBS += -lglut
Oh, silly me. I just realized that the correct lib to add was just -lglut and not -lglut32. This is because there exists libglut.so, and not libglut32.so.