Thank you, it worked. It was a problem with the version as you said.
I downloaded the binaries from the section "Allegro 5.2 binary packages" for MSVC. But it didn't have all the necesary files, only some.
I made a proyect on Visual studio and downloaded the Nuget package for that proyect and copied the missing files from this proyect from the "packages" folder, it had a filder called Allegro.18.104.22.168.
I changed the references from my .pro so it points to the files I copied from the proyect on visual studio:
LIBS += C:/Qt/5.9/msvc2015/lib/allegro.lib \
I leave what I did in case someone else has the same problem.
By the way I didn't made the proyect on Visual Studio because I needed to add an interface for my QT proyect