views:

284

answers:

4

I am working on reviving an old project (that only works with < 5.1) that essentially compiles PHP 5.3 into a PE C++ EXE. I have gotten everthing to work really well on multiple Windows 7 computers with only 2 dlls and 1 exe for most applications! Unfortunately, on XP I get:

the application failed to start because the application configuration is incorrect

I have installed Microsoft Visual C++ 2008 Redistributable Package to no avail. I have also copied msvcm90.dll, msvcr90.dll, msvcp90.dll to the same directory as the exe. This also did not work.

Do I just need to compile the project on XP for it to work on XP?

I am really good at PHP, but C is not my forte, so I assume I am missing something obvious in the compiler.

EDIT: When I compile with just Multi-threaded (/Mt) I get this:

MSVCRT.lib(MSVCR90.dll) : error LNK2005: _fflush already defined in 
LIBCMT.lib(fflush.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
out/console_debug.exe : fatal error LNK1169: one or more multiply defined symbols found
+3  A: 

Try using Dependency Walker on XP to see if you can find any missing dependencies.

Also check the Event Viewer. And make sure you're building the application in Release mode.


Dependency Walker showing a dependency on DWMAPI.DLL is often an incorrect reporting, which can result from having a dependency on mshtml.dll on an XP box with IE7. Did you check the Event Viewer?

The build errors that you posted suggest that you're linking to libraries that are NOT built with /MT flag. Make sure you rebuild everything in your solution; your 2 DLLs, the .EXE and any static libraries with that same flag, assuming you own the DLLs as well.

Gerald
It tells me I am missing EFSADU.DLL and DWMAPI.DLL . Now I just need to find those....
Ramblingwood
According to http://www.msfn.org/board/missing-dwmapi-dll-and-efsadu-dll-t93950.html those DLLs are Windows Vista and up only. It seems that EFSADU.dll isn't required but DWMAPI.DLL is, so I need to see what is wrong.
Ramblingwood
I copied DWMAPI.DLL to \Windows\system32\ on the XP machine. It didn't help. The EFSADU.dll just deals with file encryption so it isn't need.I can post my dwi if needed.
Ramblingwood
I updated my answer with some additional information based on your comments, and your updated errors.
Gerald
Ah, thank you. I will check this out tomorrow because it is late here... What you said seems very logical.
Ramblingwood
I don't have time for this project right now, so I will work on this next weekend, but this answer really poitns me in the right direction.
Ramblingwood
+1  A: 

Have you tried Project/Properties/ Configuration Properties / C/C++ / Code Generation / Runtime Library -> Multi-threaded (/MT) ?

henle
I have updated my first post to show what I get when I do that.
Ramblingwood
This has solved other problems I have had in the past though, but not this time.
Ramblingwood
and it's not possible to address those issues? Just curious
henle
What do you mean by 'those'? I have fixed other errors in other programs with that, but that didn't work this time. I just forgot to mention it.
Ramblingwood
the multiple definitions, i mean
henle
oh, well yes. I guess it is. I good round of googling gave me nothing useful on the multiple definitions, where as this problem seemed to be well documented.
Ramblingwood
+2  A: 

Do you have the manifest files in your application directory? I'd recommend to make sure they are there and refer correctly to the DLL locations. Take a look at this reference:

http://msdn.microsoft.com/en-us/library/ms235342%28VS.80%29.aspx

Fabio Ceconello
I don't think I have one, should I?
Ramblingwood
If you build your executable to use the runtime libraries as DLLs, yes. Even if you have all the DLLs installed in the target machine, your EXE won't be able to find them without the manifest file. But one alternative is to link the runtime as a static lib, as henle suggested. Of course, your executable will grow in size accordingly.
Fabio Ceconello
A: 

Try installing the VC2008 redistributables on the XP machine.

valdo