Exe is not valid win32 application but running on 64bit - c++

I have the application that I was modifying and then I compiled it in Visual Studio 2012 (C++ app). When I tried it on 64bit windows, application worked, but when I´m trying to run it under 32bit windows xp I´m getting message like ".exe is not a valid win32 application". I have found several advices on the internet but nothing worked so now I don´t know where is the problem because I´ve been testing it on several win7 64bit OS.
In Visual Studio in Configuration manager window I have selected option win32 at project´s platform column.

You should review all the project settings.
"Win32" is just a name. For e.g., you can target Machine->X64 in linker setting despite the configuration name.

Without more information, I would say you are linking against 64-bit only libraries which are not available on the 32-bit platform. Check your linker settings and build again.

Related

64 bit c++ console application in Visual Studio [duplicate]

I'm using Visual Studio for c++ programming, and after working and writing programs in x86 environment (32bit Mode) I tried to build my x86 project in x64 environment so I thought that I should create a win64 console project instead of win32 console project but there were not such as an option in VC2010 . so I want to ask that for building x64 projects I should also choose win32 project and change the settings for compiling in x64 inside the project using instruction in here?
I'm using windows 7 64bit.
if your answer is yes then why it is called win32?
"Win32" is the name of the OS API.
"Win32 Console Application" got its name from the API (not from bit-ness).
Win32 API can be used both by 32-bit and by 64-bit applications. So, a Win32 Console Application can be built both for 32-bit and for 64-bit. For the latter, create the "x64" configuration in the Configuration Manager.
The other answers pretty much have it covered, but I thought I might add the following clarifications:
X86 is for Intel/AMD's 32 bit chip set. Win32 can support other chipsets, such as ARM in a Windows Mobile project.
Furthermore, when building native c++ applications for x86, the platform will actually be called win32.
I think there is a confusion here, tell me if I am wrong, but you're basically have problems setting up your console program to the x64 platform.
If you're using the express version you will need to install a proper Microsoft Windows SDK for Windows 7 and .NET Framework 4 and SP1, as stated on the link you provided otherwise the x64 platform option won't be available. Have you already done this?
Once done this, switching to the x64 will be pretty easy, you will get the option on the dropdown list of the platforms, should compile fine (and no, you don't need to use the win32 configuration).

Deploying Gstreamer 1.0 for Win32

I have successfully compiled a project with the SDK of 1.5.2. I took that application and the dlls to another machine, and it said it was not a valid Win32 application.
I compiled on a Win64 OS. Am I supposed to install Gstreamer on the other machine to run this application, or am I missing some dlls?
I have uninstalled Gstreamer from the computer I compiled it on, and ran the application with no problems, but when I run it on another machine it said not valid Win32 application.
Application compiled on Windows 7 64-bit.
Application target to run on Windows XP 32-bit.
I found out that in visual studio 2012 update 4 I need to select a few things to make it work.
Project Properties
1. Configuration Properties -> Linker -> System -> Left Windows on top under SubSystem select Console or Windows
2. Configuration Properties -> General -> Left window under Platform Toolset select "Visual Studio 2012 - Windows XP (v110_xp)"
Use Dependency-walker to check for required but missing DLL dependencies on the machine you want to deploy to.
Typically, you are missing the required C++ redistributable runtime for your specific Visual Studio version on the target machine.

Add-on for IE8 only visible when I debug it from Visual Studio

I am following the C++ example for creating a BHO for Internet Explorer 8 here: http://msdn.microsoft.com/en-us/library/bb250489.aspx
I managed to compile and debug the extension without a problem (I use Visual Studio 2010). If IE was started from the debugger I can see all my addons in IE when I click "Tools" -> "Manage Add-Ons". However, when I start IE8 directly (by double-clicking its icon) - I do not see the addons. I am 100% sure that I have registered the addons with regsvr32.exe .
I even tried to run IE8 "as administator", but nothing changed.
Why are my addons disappearing when I start IE8 without using the debugger ?
If you have a 64bit system, chances are that under the debugger you are running a 32bit IE while from the desktop you launch 64bit IE. Then, if you ran regsvr32.exe from the SysWOW64 directory it would make sense that only the 32bit IE sees the add-on.
To overcome this you need to:
Make a 64bit version of your solution, creating a 64bit build configuration in Visual Studio is quite clearly explained here
Register the produced dll with the regsvr32 from C:\Windows\System32 not C:\Windows\SysWOW64

Using Visual Studio 2012's compiler to make Qt applications for Windows XP

I know that since VS2012, Microsoft has stopped the support for Windows XP. There is an update for VS2012 so developers could make applications that are supported by Windows XP. Right now I started learning the Qt library. I use Qt Creator and the compiler that I use is from VS2012. Is there a way to select option in Qt Creator so it can produce a valid 32-bit exe for XP? Or is it better to install on my PC VS2010 and use it's compiler? By the way I'm making the applications on Windows 7 and everything works.
We are currently using VS2012 and taking advantage of the update you mentioned to target our VC++ binaries to Windows XP. It's working fine. In Visual Studio, we do this by going to the project properties, Configuration Properties->General->Platform Toolset and selecting "Visual Studio 2012 - Windows XP (v110_xp)".
Checking the compiler command line options (Configuration Properties->C/C++->Command Line), it seems that the switch which tells the compiler to target XP is the following:
/D "_USING_V110_SDK71_"
And in the link command line options:
/SUBSYSTEM:WINDOWS,5.01
/SUBSYSTEM:WINDOWS,5.02
First one for x86, second one for x64 (use only one). If it's a console application, use these instead:
/SUBSYSTEM:CONSOLE,5.01
/SUBSYSTEM:CONSOLE,5.02
I changed the platform toolset and these went away, so I guess they are what you need. In QtCreator, you should edit the compiler and linker command line options accordingly.
Edit: If that doesn't work, try the instructions from the "Targeting from the Command Line" section on this article.

what's the relation of "win32 project" name in visual studio to x86 or x64 platform

I'm using Visual Studio for c++ programming, and after working and writing programs in x86 environment (32bit Mode) I tried to build my x86 project in x64 environment so I thought that I should create a win64 console project instead of win32 console project but there were not such as an option in VC2010 . so I want to ask that for building x64 projects I should also choose win32 project and change the settings for compiling in x64 inside the project using instruction in here?
I'm using windows 7 64bit.
if your answer is yes then why it is called win32?
"Win32" is the name of the OS API.
"Win32 Console Application" got its name from the API (not from bit-ness).
Win32 API can be used both by 32-bit and by 64-bit applications. So, a Win32 Console Application can be built both for 32-bit and for 64-bit. For the latter, create the "x64" configuration in the Configuration Manager.
The other answers pretty much have it covered, but I thought I might add the following clarifications:
X86 is for Intel/AMD's 32 bit chip set. Win32 can support other chipsets, such as ARM in a Windows Mobile project.
Furthermore, when building native c++ applications for x86, the platform will actually be called win32.
I think there is a confusion here, tell me if I am wrong, but you're basically have problems setting up your console program to the x64 platform.
If you're using the express version you will need to install a proper Microsoft Windows SDK for Windows 7 and .NET Framework 4 and SP1, as stated on the link you provided otherwise the x64 platform option won't be available. Have you already done this?
Once done this, switching to the x64 will be pretty easy, you will get the option on the dropdown list of the platforms, should compile fine (and no, you don't need to use the win32 configuration).