Crash on Windows 7 but running on XP - c++

i've written a small application using c++, Qt and Visual Studio 2010. It's working on Windows XP (32bit) but it crashes on Windows 7 (64 bit) right after start-up. I see a "The program has stopped working..." error. Do I have to recompile the application for Windows 7? And is it possible to get more information why it crashes?
Thanks

In general you wouldn't have to recompile for windows 7, but it depends on your application which you haven't provided details of.
The easiest way to find out is either debug it in windows 7 or put more error handling in, so that it lets you know what has gone wrong, or where it has gone wrong

I agree with what martiert said, also, if you are using some external elements, images. sound files, video files, etc ... be sure of the file location asd this was a problem for me when I was presenting my graduation project, I moved the whole solution from a directory to another and it crashed because it was reading a not found directory ... so be sure of the links of the images, videos, sounds etc ...

You might have to recompile for Windows 7/64bit. It might not even work after a recompile, since Windows 7 is not XP, and a program written for 32 bit might not work for 64. Often one don't have to recompile, but sometimes one have to, and some times a program which works on XP won't work on Windows 7.

Related

error in _bitset.h file header file: array must have at leas one element

I have programmed an application in C++Builder 6, compiled in Windows 95, the application works perfectly.
The error appears when I compile the application on Windows 10. The following error occurs in the header file _bitset.h:
In
template <size_t _Nw>
On the line
_WordT _M_w[_Nw];
array must have at leas one element
Any ideas?
Thank you all for answering...
I finally solved the problem...
Although the version of the class that I had installed on the new pc seemed the same as on the old pc the "boost_1_31_0" the _biset.h files were different, it was enough to replace the ones on the new pc with the old ones and EUREKA.
Thank you all for your time and excuse my English.
Without MCVE source code or BCB6 installed on Win10 we can only guess sohere are few hints instead of direct answer...
First OS related hints:
There where quite a few changes in OS since BCB6 times. The most likely reason for problems are wrong absolute paths on 64bit windows simply copy compiler and IDE stuff from:
[Program Files (x86)]
into:
[Program Files]
that usually works for most of the older IDEs and SW build before 64bit Windows (like GC/GCC + Eclipse).
On top of this Win10 changed process scheduling to the point many older SW does not work properly or at all and even compatibility modes are useless in Win10. My experience with direct successor of BCB6 (BDS2006 Turbo C++ Explorer) is that to run properly you have to:
run IDE as administrator
You can set this in BCB6 icon properties (compatibility).
set IDE process affinity to single CPU
You can set this in Task manager on BCB6 process. Without this the IDE will freeze for few seconds (up to 45sec) every few minutes (or seconds).
Beware if your app is multithreaded You have to set its affinity back to all CPUs somewhere in your App init code. This is done like this:
Cache size estimation on your system?
Just look for SetProcessAffinityMask usage in the last code there.
install font fix for user folder
I do not know if BCB6 needs this but BDS2006 will not work properly without it as after some Win7 update MS changed the policy of user folder and having fonts there is no longer allowed without fix.
If nothing works try to use Win7 there usually works everything on first try without any problems. Old developing tools tend to not work at all or properly on Win10 and newer versions are usually much worse than old some to the point of to be unusable especially for MCU and USB stuff. So its always a good idea to have a backup Win7 PC for development.
Now code related hints:
Different OS mean different compiler #define directives which means some parts of code might be different then on Win95 see:
C++Builder Compiler Version
so some (most likely inbuild) header files you use might be wanting to see some OS version and have numbers that are not handled in code properly causing some parts of code are not compiled. The remedy is simply to look for those #define in code and either change the version numbers or add new entries ...
Also it looks like BDS2006 compiler bug fix can remedy some weird bugs on BCB6 too so see:
bds 2006 C hidden memory manager conflicts (class new / delete[] vs. AnsiString)
Too many initializers error for a simple array in bcc32

My program doesn't run on some PCs

I'm working in a project building an application with Computer Vision using C++, OpenCV and Visual Studio. I'm no expert in deploying programs to use them on other PCs.
I've made a program which I need to distribute to a certain amount of people and I can't make it work on all the computers I'd like to. The program was written using Visual Studio 2015, it's an MFC Project and the code is written in C++ since I'm using OpenCV.
When it was finished, I tried to run it on another computer and I realized that it won't open. I looked on the Internet and found out that I needed to statically link the libraries, so I did it. Also, when I was looking for information, I found that Visual Studio 2015 builds its projects so you can run the programs on machines with Win7 to Win10. When I learnt that, I tried to open it on PCs running Windows 7, 8, 8.1 and 10. I tested my program in like 20 computers, give or take.
The results? I couldn't make it work for Windows 7, the error ucrtbase.terminate api-ms-win-crt-runtime-l1-1-0.dll showed every time I tried to open it. It also didn't open in one machine with Windows 8 without showing any error message, but it DID open on most of the machines with Win 8.1 and Win 10. The thing is that "most"; there were some PCs (with Win 8.1 and 10) that I couldn't open my program on. I found that sometimes it would show up in the Task Manager for less than a second and then disappear. The most stressful thing is that it doesn't tell me what the problem is, it doesn't show any error message. It just won't open.
I tried using Dependency Walker (both on my PC and one of those that I couldn't run my program on) to see if there's something missing and I got a reeaaally long list of files that the system couldn't find, here's an example:
List 1/11. Something curious is that my program executes just well on my computer and on those I could open it, even though Dependency Walker (DW) tells me that there might be a problem with it. This indicates me that DW is not finding the exact error I'm having.
Another thing I've tried is to compare the things I have installed on my computer and install them on the one I want to execute my program on. I tried installing .NET Framework 4.6.1 just because VS 2015 says that my project was built using it (and I have it installed in my PC and that other one doesn't. Also I tried with .NET 4.6.1 SDK). Nothing changed.
Just look here:
https://msdn.microsoft.com/de-de/library/ms235299.aspx
The quick-and-dirty way would be to copy the DLLs from your redist directory. For my MS VS 2013 it is hidden under the VS installation directory in:
VC\redist\x86
or
VC\redist\x64
...
which depends on your application.

VC 2010 Executable Not Running on Other Computers - No Errors

I'm running into a strange thing while making a game in VC++. I'm using the Cocos2d-x platform and VC++ 2010 in Windows 7 and it works perfectly fine on my machine. However, I have another computer that is Windows XP. I am currently using /MT so there is no problem with the runtime library, but the program doesn't run in Windows XP and it doesn't even produce an error. I have tried with 2010 C++ redist on the other computer, and it doesn't work with or without. There is nothing in the console and no error log. Nothing appears odd in DependencyWalker, only missing internet explorer frame stuff. What can cause a program on windows XP to execute and close immediately without leaving an error?
Anyone has any ideas? I am using the game framework's dynamic linked libraries, so could that be a problem? Also, even though I linked statically, my executable is only about 140 KB. Is something messing up?
Thanks for any help.
EDIT: There's also an interesting problem with CRT I ran into before. When I ran the program with permission level "asInvoker" on windows 7, I got a "CRT Not Initialized" error. Once I set it to "highestAllowed", it started working but I was wondering if it had anything to do with CRT?
Okay, I've found the problem. It turns out that my other computer has an integrated Intel Graphics card that doesn't support the graphics renderer (OpenGL ES 2.0) that the framework uses. That's why it ends up crashing without outputting any errors.
Thanks to anyone who helped.

Phonon problem in Windows 7 with code compiled in XP

I have some code compiled using Visual Studio 2010 (C++), with Qt for the GUI and Phonon to show some videos.
I compile and run the code in a Windows XP machine and everything works fine. The videos and controls are shown correctly, and the same in other Windows XP machines. But at the moment that I try to use a Windows 7 machine, the video is not shown. Phonon controls are loaded, I can adjust the size of the Phonon VideoWidget but nothing is shown. I am using the SetFile method to indicate the file location and I have also tried (of course, with no luck) with setCurrentSource in the MediaObject (it works, though, in Windows XP).
I have tried different locations of files (absolute/relative) but nothing seems to work. Also, in XP when a video is not found an alert message is shown while in Windows 7 there is no error message, but also no video is shown. If I try to open the videos with other players, they work fine (I tried also with videos with different formats).
Any idea on what can be wrong? Is there something that I am missing with Phonon and Windows 7? Thanks!
When deploying your application to a different computer, make sure you don't forget to copy the Phonon backend. Not just the DLL contained in it (the ds backend for me), but also the directory itself.
That is
-Application Directory
¦-myexe.exe
¦-phonon_backend
¦-phonon_ds94.dll
Furthermore the Phonon backend on Windows (and Mac I think) makes use of the QtOpenGL module. So don't forget to copy this either. It can go inside the application directory.
In any case you could help yourself out a bit by adding a small bit of code that shows (perhaps writes to a file) which mimetypes are available. If it doesn't spit out anything, there is a problem with your backend. (Well, that of your application...)
This is what I had to do when I used Phonon to play video inside my application. Since I only quickly added this some time ago to my application, I'm not 100% sure that this is the only (or even the proper) way to do this, so anyone who has different insights feel free to comment on this.

Problem starting old programs created in VS6

I have some old programs that I created 7-8 years ago in C++ in Visual Studio 6.0.
I tried to start them today, but I had no luck. When starting up the program (or any other program I created at the time), I get the following error message:
I can see at least that MFC42D.DLL and MSVCP60D.DLL is present in the program folder, but honestly I do not remember what is required to start these programs any more, and I obviously do not have VS6 installed on my current machine.
Do anyone know what this error message mean, and what I can do to resolve it? I would love to start up these old programs again to see what they look like :)
EDIT
I got a step further now, after I put a new DLL, but now the problem is that Direct X 8 is not getting set up properly. I thought DirectX was backwards compatible, but do I have to install DX8 as well? Will it work having two DirectX versions installed at the same time?
You need a program like dependencywalker, that would show you all the DLLs that your programs need. Then you would have to find all those DLLs.
Another option is to find a copy of VisualStudio 6 and install in on your machine.
A third option is to get a more recent version of Visual Studio, and to try to recompile your code.