I had previously posted a question trying to inquire about the difference between the MSVC x86 SFML lib downloads. I had been having library problems and I assumed I had downloaded the wrong library version and downloading the correct library would fix it. However, I'm still having issues so I've decided to post this thread as a more direct request for help. Now onto the issue.
I'm currently working on a Qt project where I plan on using SFML. I'm running into a problem when I attempt to statically link to the library.My Qt project is configured to use the MSVC2015 32bit compiler and I have downloaded the MSVC2015 32 bit SFML library.
A screen shot of the Qt project configuration is located here:
http://imgur.com/a/uQpTdThe corresponding qmake code is added to the .pro file:
http://imgur.com/a/DkIjpSo I believe I should be all set to start using the static library. I will attempt to create an SoundBuffer instance (a class defined within the static library).
#include "mainwindow.h"
#include <QApplication>
#include <SFML/Audio.hpp>
int main(int argc, char *argv[])
{
sf::SoundBuffer buffer;
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
I then proceed to get the following errors:
http://imgur.com/a/tz9lKThe build process fails when I attempt this. However, if I comment out the SoundBuffer, the project builds fine.
It states that there are unresolved external symbols. Now I am a noobie with linking to static libraries, but I assume this means that it can't find the corresponding class in the .lib file. It knows that it exists due to the header file, but it can't actually determine how it is defined. Am I correct in assuming this?
The next red flag that is raised is the the fact that it is generating .dll related messages even though I'm using a static library. I have also verified countless times that the library I'm trying to link to is in face a static library.
HOWEVER, if I decide the link against the dynamic library (via the import library), the project builds just fine. I then move the dll's to the directory containing the .exe files and the project runs just fine with no crash.
So what exactly is going on? Why can't I link against the static library, but I can link against the dynamic version just fine? Furthermore, why does the compiler generate linker issues stating that there are unresolved external symbols and then proceeds to mention the declspec(dllimport)? I'm not using the library as a dynamic library...
Any recommendations of the next step of troubleshooting?