compile error msvcprtd.lib

keldath

LivE LonG AnD PrOsPeR
Joined
Dec 20, 2005
Messages
7,373
Location
israel
hey folks,

i keep getting these messeges.
tried 2017/19 and 2010 exp.

copied the libs to the tool kit,
thing is i changed my cpu.
i tried lots of things, none removed these.

1>msvcprtd.lib(nothrow.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored
1>msvcprtd.lib(nothrow.obj) : warning LNK4078: multiple '.CRT' sections found with different attributes (40300040)
1>msvcprtd.lib(nothrow.obj) : warning LNK4229: invalid directive '/FAILIFMISMATCH:_MSC_VER=1600' encountered; ignored
1>msvcprtd.lib(nothrow.obj) : warning LNK4078: multiple '.CRT' sections found with different attributes (40300040)

?anyone got a lead on this?
i haven't found something useful in the forum, yet.
 
The main problem is that you somehow ended up compiling with a modern compiler rather than the makefile. Even if you manage to remove those warnings, whatever you produce is not likely to work or at least be stable.

Code:
#### Tools ####
CC="$(TOOLKIT)\bin\cl.exe"
CPP="$(TOOLKIT)\bin\cl.exe"
LD="$(TOOLKIT)\bin\link.exe"
RC="$(PSDK)\bin\rc.exe"
You need to make sure those link to MSVC 2003, not your modern MSVC.
 
how do you suggest i check the TOOLKIT and PSDK param?
I think the idea with that generation of makefile is to set them as environmental variables. You can however also edit the makefile or the project file where the makefile is called from.

Code:
set CONFIG_CFLAGS=-DHARDCODE_XML_VALUES
set TEMP_DIR_POSTFIX=_HARDCODED
set TARGET=Debug
bin\jom source_list /NOLOGO && ^
nmake precompile  /NOLOGO && ^
bin\jom build /NOLOGO
This is my current call in WTP. In other words the calls can be made quite complex if needed. Those calls are in Project->(project name) properties->nmake. Here you can click for build, clean etc and select edit for each line.

Alternatively just edit the makefile itself with the full path.

The environmental variable approach is likely the one, which makes it the easiest to distribute your solution and get other people to compile it.
 
@f1rpo / @Nightinggale
hey guys,

i did the following -> created a clean VM using HYPER-VM on win.
installed only the required from the simple guide.

same 4 warning still appear.

i ran a debug-opt option (advciv nmake).
and there were no errors.

so i looked,
$(LIBS) msvcprt.lib -> this is being used both by debug-opt and debug compiles.

so the only difference is the CFLAGS=:
!IF "$(TARGET)" == "Debug"
CFLAGS = $(Debug_CFLAGS)
!IF "$(TARGET)" == "Debug-opt"
CFLAGS = $(Debug_Opt_CFLAGS)

the Debug_CFLAGS after i replaced the vars with their data :

Debug_CFLAGS=/Od /RTC1/DWIN32 /D_WINDOWS /D_USRDLL /D_DEBUG /MD /GR /Gy /EHsc /Gd /Gm- /Fd"$(Target_PDB)" $(CUSTOM_CFLAGS)/WX /W4 /Ob1 /Z7

compared to the nmake from the simple guide links:

Debug_CFLAGS=/MD /Zi /Od /RTC1 /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /D_DEBUG /GR /Gy /W3 /EHsc /Gd /Gm- /Fd"$(Target_PDB)" $(CUSTOM_CFLAGS)

i read some on /Zi,
maybe there something with it?
--
edit, nope the zi didnt affect it.


any ideas?
 
Last edited:
The Debug-opt target in the AdvCiv Makefile uses the Release options together with the Debug options:
Debug_Opt_CFLAGS=$(Release_CFLAGS) $(PROJECT_DebugOpt_CFLAGS)
where
Release_CFLAGS=/O2 /G7 /arch:SSE2 $(Release_DEFINES) $(GLOBAL_CFLAGS)
and
Release_DEFINES=/DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DNDEBUG
PROJECT_DebugOpt_CFLAGS (Makefile.project) doesn't normally do anything interesting. And CVGAMECOREDLL_EXPORTS seems to be unused; I'll try removing that entirely from the Makefile. But you could try gradually adding
/O2 /G7 /arch:SSE2 and /DNDEBUG
to the PROJECT_Debug_CFLAGS. Uncertain if that'll ultimately help diagnose the problem.
Perhaps also worth noting that I personally use version 6.0 of the Win Platform SDK as opposed to version 7a in the guide. Generally, both seem to work, but perhaps not in all circumstances.
Edit, upon re-reading my own Readme behind the link above:
I said:
The Service Pack adds msvcprtd.lib, which debug builds require. If the toolkit doesn't provide the 2003 version of that file, the compiler will fall back on whatever is available in Microsoft Visual Studio (VS). The msvcprtd.lib included in VS 2010 seems to do the job, but will issue warnings when certain parts of the standard library are used, e.g. std::stable_sort. Adding the proper version of msvcprtd.lib to the toolkit also seems to get rid of unhelpful LNK4089 warnings in release builds with /OPT:REF.
So rather than the Win Platform SDK version, the version of the MSVC Toolkit might be the issue. Along with certain functions of the standard library (e.g. stable_sort) used by AdvCiv (and not by most other mods).
 
Last edited:
conpile work but,

when game map gen is done,
the load failes on:

// Don't want this to be inlined; out-of-class definition accomplishes that.
bool SelfMod::testCodeLayout(byte* pBytes, int iBytes, uint uiStart) const
{
for (int i = 0; i < iBytes; i++)
{
byte iActual = reinterpret_cast<byte*>(uiStart); // for inspection in debugger
if (pBytes != iActual)
{
#ifdef _DEBUG
FAssertMsg(iActual != 0xCC, "Interrupt found in native code. "
/* Remedy: Should probably keep breakpoints disabled
until SelfMod is finished */
"Debugger breakpoint?");
#endif
FErrorMsg("Unexpected memory layout of EXE");
return false;
}
}
return true;
}

FYI , im with th3e steam version unlike before of GOG's complete.


@f1rpo ,
seems that using the steam version rather the the unsupported beta instllation from steam,
causes this error to pop with the the debug dll.

any thoughts? which version do you use?
 
Last edited:
The beta version EXE should be the same as the GoG and disc version. The default Steam version is slightly modified, presumably, to integrate it with the Steam Lobby (or what it's called; I don't use Steam myself). I hear that e.g. Realism Invictus works with both Steam versions, but, generally, and in the case of AdvCiv, the beta is the one to use for DLL mods.
 
The beta version EXE should be the same as the GoG and disc version. The default Steam version is slightly modified
I investigated this claim for Colonization. CD, DVD and GOG versions have identical exe files, revealed not only by version number, but also MD5. However steam has steam specific data in the exe and this includes the beta. I'm not sure it really matters through unless you do something advanced. Steam crashes the game intentionally if a debugger is detected while GOG doesn't. This is likely some steam anti-cheat because it can't tell the debugger apart from say a wallhack where you can see enemies even when behind covers. It makes little sense to use such anti cheat in civ4, but it's there anyway.

People who really want to use a debugger with the steam version should use steamless.
 
Oh, right, both Steam versions of the EXE have those protections, so neither can be identical to the original EXE.
looks complicated to use the steamless..
Isn't it just a release with an installer that does everything? Can't try it myself. Anyway, seems that this is the only way to use a debugger.
 
Top Bottom