Omid
Omid

Reputation: 283

Qt entry point not found in visual studio release mode

My Qt Widgets application (Qt 5.15) works fine in Qt creator 4.12.2 with MSVC2019 64bit compiler. Using Qt VS Tools v2.5.1 and the same compiler I was able to run the project in Visual Studio 2019 in Debug mode, but when I try to run the project in Release mode, I get the following error message:

Entry Point Not Found. The procedure entry point ?contextMenuEvent@QLabel@@MEAAXPEAVQContextMenuEvent@@@Z could not be located in the dynamic link library C:\...\app1.exe

I know there are similar questions (See here and here) but the error messages there clearly state a missing .dll file while in my case it is refering to a .exe file. Can someone explain why this happens and how can I resolve this issue?

Upvotes: 0

Views: 2597

Answers (3)

aapa320
aapa320

Reputation: 422

I had a very similar problem but with QPushButton instead of QLabel. The problem was that for some reason, Visual Studio was loading some of the Qt .dlls from seemingly random places.

Check the Debug output and see if there is something weird. In my case Visual Studio was "loading" the Qt5Gui.dll (among others) from C:\ProgramData..\miktex\5.15.0\msvc2019_64\bin...

Where it obviously wouldn't be found. So, check for those strange messages, like for instance:

"myprogram.exe" (Win32): Loaded "C:\somewhere\outside\qt\folder\5.15.0\msvc2019_64\bin\Qt5Gui.dll". Symbols loaded.

The "C:\somewhere\outside\qt\folder" folders were in my Path, so I removed them and then Visual Studio had no trouble loading the dlls from the right place.

Upvotes: 2

RayX
RayX

Reputation: 116

The simplest solution is to build directly to the qt bin directory. In VS open Project > Properties dialog, under General/Output Directory enter proper qt bin path (something like "C:\Qt\5.14.0\msvc2017_64\bin"). That should do the trick.

Upvotes: 1

Supaidaman
Supaidaman

Reputation: 31

It is possible that some of the dlls required by Qt are not being copied to the directory of your release build, like those errors you linked, at least from similar errors that I've experienced. I'm not sure why the error is on the .exe itself though.

One dumb way you could test is throwing your exe together with all the dlls from Qt in a directory and seeing if anything changes.

Also, be sure that you're using the same Qt version on VS and QtCreator, specially if you have multiple ones installed.

Upvotes: 1

Related Questions