QScintilla, example project doesn't work - c++

I wanted to try QScintilla out. So i downloaded and installed it, no problems.
When i ran the example project it said I was missing QtCored4.dll, so i copied it into the directory, then it said it needed other dll's aswell so copied them too.
At the end it gives me a Visual C++ Runtime error. It just says it terminated in an unusual way.
I know this is vague, but this is just what is states, no additional error messages. The code is from the website, i didn't modify it.
Anyone has any clues about this?
Now that i have this problem, i thought maybe i should extend the standard Qt text component. And try to make my own component like QScintilla.
How hard can it be, to write a component like QScintilla? (Without looking at its source)
Update: So i loaded the example project under Qt Creator. Set the default config to release mode and let it run. And it worked. (very weird). If i switch to debug mode Qt Creator says:
Invalid parameter passed to C runtime function.
If i go to the directory in the file system ( not in Qt Creator ) and run the program (release mode), i get the strange errors i told you about in the comment. While if i run it from Qt Creator it works.

I have no problems with QScintilla. I have Qt 4.6 compiled from sources with VC++ 2008. After downloading QScintilla-gpl-2.4.1 and unpacking I compiled it with:
cd Qt4
qmake qscintilla.pro
nmake
and finally installed with
nmake install
copy %QTDIR%\lib\qscintilla2.dll %QTDIR%\bin
And while compiling and running example I have no problems.
So, first check you environment variables (My Computer, Right Click, Properties -> Advanced tab -> Environment Variables button). Check Path in System Variables section. I have %QTDIR%\bin (c:\Qt\qt-4.6.0\bin) in this variable.
Secondly I'm wondering about letter "d" in your message:
QtCored4.dll
If you made all steps described in documentation you will get release version of libraries and release version of example application linked against release version of Qt libraries. And not debug.
Finally may be QTextEdit & QSyntaxHighlighter is enough for your tasks. Check out Syntax Highlighter Example.
Response to comments.
It's some sort of well known problem (may be). So, as you can see you have 2 different folders with Qt libs
C:\Qt\2009.05\bin;C:\Qt\2009.05\qt\bin
in your path. Libraries in the first folder (...\bin) compiled with VS2008 and libraries in the second one (...\qt\bin) compiled with MinGW. The items in path variable are looked up when your application starts. Suddenly the folder with "wrong" libraries exists before the folder with correct item in your path variable. What you can do is to copy QtCore4.dll, QtGui4.dll and other libraries that you need to folder with your application executable. Hope this helps.
Some links about this problem:
#qtforum.org
#some blog post (in Russian =))

Related

Missing libgcc_s_seh-1.dll starting the .exe on Windows

Intro
I have a CMake-based C++ project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
I made sure it still works through the IDE.
I found this dll does not exist in the MinGW installation folder.
I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll files your .exe file(s) depend on in the same folder as the .exe file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll files your .exe file depends on.
Or use the command line tool copypedeps -r from https://github.com/brechtsanders/pedeps to copy the .exe files along with it's dependencies.

Qt-Application Deployment doesn't work. Missing entry point and dll's

In the last months I created a project with the Qt-Creator version 4.7.0, Qt version 5.11.1 (open source version).
Now I tried to deploy it following the Qt doc and building the project with MSVC2017-64bit compiler as well as running windeployqt.exe afterwards on the generated executable.
As I tried to run the executable after the programm finished copying the neccessary dlls into the folder, a warning appeared:
The entry point ?
eventFilter#QAbstractItemView##MEAA_NPEAVQObject##PEAVQEvent###Z wasn't found in DLL "my/project/path/releasefolder/project.exe".
It seems to me like something was wrong with the Qt-Objects I use in my project, but I couldn't find anything, as it still worked flawlessly in the Qt-Creator.
A thought it might be due to the compiler having issues, so I changed it to mingw32, which I also tried to deploy the same way. But somehow in this case the warning disappeared, but many dlls were still missing even though windeployqt.exe should've already done that. And I also couldn't find them anywhere on my hard drive. I also tried a third compiler, but the issues weren't going away.
I searched online and only found people having problems with an entry point missing in a Qt dll or missing the Qt-Dlls in general, but haven't found anything related to my case.
I also tried Dependency Walker on every executable, but it found even more missing dll, which led me to believe the executables were somehow currupted so I tried it again and again, but with no success unfortunately.
Has someone any idea, why that could happen, or any suggestion for me?
Maybe I should change something in my project, even though it works fine in the IDE. I just need a way to deploy my Qt project in any way.
EDIT: Build using the Desktop Kit in Qt Creator with MSVC2017 the described warning appeared.
Build with Mingw32 (Desktop Kit) and with MSVC2017 using the UWP Kit in Qt Creator the following Dll was missing, that I haven't found anywhere on my hard drive: MSVCP140_APP.dll
EDIT2: I ended up downloading the required dll, to somehow get it to work, but it still didn't work. One build, that required that dll now started but immediately closes itself again and the other build was suddenly warning me of a missing procedure entry point.
EDIT [SOLUTION]: I let the Qt Creator create a whole new fresh project and copied all files from my old project in the new one. After that I only copied all the dll files into the folder and it worked.
Instead of relying on windeploy, manually add the dll. I am assuming you have built the project using mingw. Assuming you are using Qt 5.11.1, go to
C:\Qt\Qt5.11.1\5.11.1\\bin\ and copy all the dll files and paste in your executable folder. Also copy all directories from plugins folder (in /plugins) and paste in your folder. Now run the application, don't close the application. Now delete all the files from your executable folder. The one's not being used are deleted and the rest are left. I assume you are doing this on target computer. This might help.

Qt platform plugin "windows" is not found on one computer

I have an application built with Qt 5.5, deployed and running on x86 Windows 7 with dynamic linking. When I try to launch it on that particular computer, I get the following error:
This application failed to start because it could not find or load the
Qt platform plugin "windows".
Available platform plugins are: minimal, offscreen, windows, windows.
Reinstalling the application may fix the problem.
The "windows" plugin is indeed repeated twice in the list.
Though I have the libraries set up properly, such that they run without an issue on my main computer, here, the platforms directory doesn't seem to be found.
File list:
MyProject\platforms\qwindows.dll
MyProject\Qt5Core.dll
MyProject\Qt5Cored.dll
MyProject\Qt5Gui.dll
MyProject\Qt5Guid.dll
MyProject\Qt5Widgets.dll
MyProject\Qt5Widgetsd.dll
MyProject\MyProject.exe
Many similar questions can be found about this error, but I have tried all the answers I have found about it (including changing file and folder names, adding various extra Qt libraries to the directory, etc.) without success. I have built the application again while making sure that all components have the right architecture, again without success.
Other than static linking, how can I make it run?
You need to put the folder 'platforms' from the \$QTDIR\$version\$complier\plugins\ (which must contains the files qwindows.dll and qminimal.dll) near your .exe file.
Usual list of dlls for Qt 5 on Windows:
Try to use windeployqt.
It'll try to autocollect all needed libraries.
Setting the QT_QPA_PLATFORM_PLUGIN_PATH environment variable worked for me.
This solution was also mentioned here and here.
Open Cmd and write this for qtquick deployment (remove --qmldir for non qtquick):
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>
For example:
windeployqt --qmldir C:\Users\Administrator\Documents\Dyn
amicView C:\Users\Administrator\Documents\build-DynamicView-vc-Release\release
Write windeployqt for more details.

Porting Qt4 to Qt5: unresolved external symbols

Qt5 is the new generation of Qt and it has some changes.
I have a project building well with Qt4. I've downloaded Qt5-VisualStudio2010 package and I'm trying to port my project from Qt4 to Qt5. Problems arise.
All 'include' paths have been fixed well. However, the compiler now reports hundreds of 'unresolved external symbols' (almost all function calls, sounds like the compiler can't find any .lib file). I even tried to add all .lib files found in the Qt SDK folder, but useless. The most basic class and method: QApplication::exec(...) also reported as 'unresolved symbol'.
The project file has been changed to fit Qt5 packaging:
myproject.pro file:
QT += widgets
Anyone have got similar experience with this new release of Qt?
From 'qt_newbie89' (http://qt-project.org/forums/viewthread/23200):
I have “accidentally” solved the problem. I rightclicked on the
project folder in the Project windows and choose qmake. After that,
choose Run and all the errors disappeared. I don’t know why that works
by the way.
From 'ChrisW67' (http://qt-project.org/forums/viewthread/23253/):
The Makefile file did not “become corrupted”: it was exactly as you
left it, full of commands and paths suitable for the previous Qt 4
installation. When Qt Creator ran nmake to build the project nmake did
not automatically re-run qmake to generate the Makefile because the
(untouched) Makefile was newer than the pro file that generated it.
This is normal and correct make behaviour, but it resulted in a
mismatch between your Qt5 in stall and expected Qt4 install.
My saying:
Yeah, that really solves the linking problem! The problem was actually that, when the project was created with Qt4, the 'make' file was also created along with the project nicely. When I removed Qt4, installed Qt5 and imported the old project by Qt5 (with new Qt Creator), possibly the 'make' file became corrupted.
I suspected that you would not be the only one who had this problem. Have you looked at: this yet? It talks about a PERL script in qt/base/bin called: fixqt4headers.pl. This is designed to fix the headers. I noticed another link which might help if that doesn't fix you up, try this, it looks to be fairly well thought out. And, no I haven't tried it. I haven't actually upgraded to Qt 5 yet. CHEERS!
This happened to me as well and I did following.
Additionally linked Qt5Widgetsd.lib
Changed the project property 'Treat Wchar_t as buil in' to true (at C++ -> Language section).

Qt not working correctly

I have just installed Qt_SDK_Win_offline_v1_1_4_en.exe and run QT Creator.
I am working on Win7 64 bit.
I wanted to make simply app with form and button on it to test Qt. I choose New->Project QT Widget->Aplikacja Gui QT ---> then Desktop application.
When I run Play Button - that should build and run the application I get a message: that I should check path and privileges. I can't also run the exe files as administrator manually because windows give me message that I don't have privileges. I gave full privileges in file Properties but then after run I am getting error that I don't have mingwm10.dll.
I gave full privileges in file Properties but then after run I am getting error that I don't have mingwm10.dll.
This means the library required can't be found in any of the locations Windows searches to find libraries. The usual method to get around this is by making sure the folder containing the copy of mingwm10.dll which the Qt SDK installs is in your PATH environment variable. Here is one of the many Google-able guides to settings those variables.
Ok, I found a partial solution, I could finally run the exe file.
First, something must have changed in my Windows7 because every new created folder (and files in it)had restrictions and noone could make all operations.
So, after changing properties of folder, I got message about missing dlls files, so I started to copy them from QT folder. There are at least a few different versions of each dll, and only one is correct, so I copy those form mingw folder bacause I used mingw compiler, and finally after copying 4-5 dll I run the exe file.
But this is not what I am expecting from app that install pack has almost 2GB...
thanks
m.