Problem with x64 hello world app...  
Author Message
Balthasar





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

Hi all,

I've been trying to port a 32bit app to 64bit these past days, and finally got the thing to compile and link after a long struggle. needless to say, the thing refuses to run on my x64 XP machine, it's missing a number of libraries (assemblies, or whatever the term en vogue these days may be. God, does anybody remember the days when code was just code Sigh.) Anyhow....

I thus am now trying to create the simplest of all apps, a hello world app built to the x64 target. Same thing happens though. Now interestingly I ran 64bit dependency walker, and on my (big) application it finds that MSJAVA.DLL is missing (what a load of bollocks. I don't use java, nowhere and never) and the hello world app is missing MSVCR80.DLL as well as MSJAVA.DLL.

Can anyone make sense of this How do I get rid of that msjava dependency

Cheers

- Balt


Visual C++3  
 
 
Ayman Shoukry





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

What is the exact error you are getting when trying to run on the X64 machine

Thanks,
  Ayman Shoukry
  VC++ Team

 
 
Balthasar





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

If I compile the .exe with the manifest file and have it embedded, an error message box comes up and says:

"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem".

And the event log has three error entries, in chronological order:
All have event source: Side-by-side
Description:
 
First event:
"Dependent Assembly Microsoft.Windows.Common-Controls could not be found and Last Error was The referenced assembly is not installed on your system."

Second event:
"Resolve Partial Assembly failed for Microsoft.Windows.Common-Controls. Reference error message: The referenced assembly is not installed on your system."

Third event:
"Generate Activation Context failed for D:\xfer\SatWhere.exe. Reference error message: The referenced assembly is not installed on your system."

 
 
Ben Anderson MSFT





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

If you have not installed VS 2005 on your x64 machine you may need to install the new 8.0 dlls in Windows Side-By-Side on your x64 machine. 

 

See http://msdn2.microsoft.com/en-us/library/ms235624 for info on deploying the dlls.  You might also try compiling cl /MT hello.cpp to use static linking instead of dlls. 



 
 
Balthasar





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

added /MT to the linker options, now the linker complains about an unknown option.

Shouldn't VC++ link statically by default If I wanted DLL hell I could have stayed with VB!

 
 
Ayman Shoukry





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

/MT is a compiler option and not a linker one.

Take a look at http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/_core_.2f.MD.2c_2f.ML.2c_2f.MT.2c_2f.LD.asp to determine how to set such options through the IDE.

Thanks,
  Ayman Shoukry
  VC++ Team

 
 
Balthasar





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

Excellent, thanks! the /MT compiler option made my test program work.

<old comment snipped>

the big app works now! I had a manifest file manually inserted into the resource, to give the dialogs an XP look and feel. I removed that manifest file, and now the app works in 64bit. HOWEVER: the XP look and feel in the dialogs is gone. Any hints on how to get those back


Thanks

- Balt

 
 
Balthasar





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

More specifically, if I compile the following manifest into the 32bit app, it gets the nice XP look and feel, but if I compile this manifest into the x64 binary, the application won't start, claiming it's missing the common controls assembly.

What would the proper manifest file look like for an x64 target

< xml version="1.0" encoding="UTF-8" standalone="yes" >

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

<assemblyIdentity

version="1.0.0.0"

processorArchitecture="X86"

name="SatWhere"

type="win32"

/>

<description>SatWhere</description>

<dependency>

<dependentAssembly>

<assemblyIdentity

type="win32"

name="Microsoft.Windows.Common-Controls"

version="6.0.0.0"

processorArchitecture="X86"

publicKeyToken="6595b64144ccf1df"

language="*"

/>

</dependentAssembly>

</dependency>

</assembly>


 
 
xavito





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

If I do static linking, I get a lot of unresolved external errors.  Has this happened to anyone else
 
 
Anup Shah





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

Change x86 to x64 and save the manifest.

If this doesn't work then change it to "amd64" and try


 
 
Ben Anderson MSFT





PostPosted: Visual C++ General, Problem with x64 hello world app... Top

You can see an example of how to enable the CC manifest in stdafx.h in the default MFC app generated by VS 2005. In my build of Orcas it looks like this:

#ifdef _UNICODE

#if defined _M_IX86

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")

#elif defined _M_IA64

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")

#elif defined _M_X64

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")

#else

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

#endif

#endif

Also please note that using the XP and higher manifests is only supported by Windows if you build Unicode. There is a lot of ANSI support for compatibility, but it's not all guaranteed to work.