2
votes

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
4
When linking statically to the CRT you have to do it in all projects involved in the solution (or all sub-projects involved in a project). If you take a look at the linker output you can see it's throwing errors that some functions are already defined. MSVCRT is used when linking dynamically, LIBCMT when linking statically. Make sure you specify /MT in all of the projects/sub-projects. Also when building all your own libs you're linking to (if any).Xandy
Well, I believe I only have one cpp file a resource file. Only one solution and 1 project. I use other DLL's but that are required at runtime and shouldn't be causing build errors.Alec Gorge
Then the problem is with the DLLs. If you can build them again, use the /MT switch, if you can't build them again (e.g. they're 3rd party and you don't have the code) your project will only build when linking to the CRT dynamically (/MD).Xandy
ok, thank you. this will help a ton.Alec Gorge

4 Answers

3
votes

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.

2
votes

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(VS.80).aspx

1
votes

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

0
votes

Try installing the VC2008 redistributables on the XP machine.