Compiling under VS2010: Difference between revisions
TomEdwards (talk | contribs) (some cleanup, still a bit of a mess though) |
Psycommando (talk | contribs) (Added a warning on using the sloppy /FORCE:MULTIPLE linker option, and added a working, proven, alternative.) |
||
Line 43: | Line 43: | ||
; Error LNK2005<nowiki>:</nowiki> ... already defined in memoverride.obj | ; Error LNK2005<nowiki>:</nowiki> ... already defined in memoverride.obj | ||
: For each affected project right-click on it, go to ''Properties->Configuration Properties->Linker->Command Line'' and in ''Additional Options'' add the following: "/FORCE:MULTIPLE". | : For each affected project right-click on it, go to ''Properties->Configuration Properties->Linker->Command Line'' and in ''Additional Options'' add the following: "/FORCE:MULTIPLE". | ||
{{warning | The "/FORCE:MULTIPLE" directive will only force the linker to output a file even if a symbol is defined multiple times. It doesn't mean it will work properly, and the linker will not link incrementally after this option is added to the command line, as stated on MSDN [http://msdn.microsoft.com/en-us/library/70abkas3%28VS.80%29.aspx]. Commenting out the "void __cdecl _invalid_parameter_noinfo(void)" function definition at line 727 (OrangeBox) of "public\tier0\memoverride.cpp", as mentionned [[Compiling under VS2008#Fix debug compilation|here]], is much less susceptible of causing further problems.}} | |||
; Linker Errors relating to LIBC, LIBCMT, LIBCD, LIBCMTD | ; Linker Errors relating to LIBC, LIBCMT, LIBCD, LIBCMTD | ||
: Go to the client project's ''Properties->Linker->Input->Ignore Specific Default Libraries'' and enter <code>libc;libcmtd;libcd;</code>. Navigate to the same place in the server project properties and enter <code>libcd;libcmtd;</code>. | : Go to the client project's ''Properties->Linker->Input->Ignore Specific Default Libraries'' and enter <code>libc;libcmtd;libcd;</code>. Navigate to the same place in the server project properties and enter <code>libcd;libcmtd;</code>. |
Revision as of 11:16, 20 July 2011
Visual Studio 2010 is the best choice for Source. You can use the free C++ Express edition.

game\server\swarm_sdk_server.vcproj
with a text editor and delete "' $File
" from line 2232. [todo tested in ?]Debugging
- Follow the instructions for fixing debug compiles in VS2008, which apply here as well.
- Right click on the client and server projects in VS and go to Properties > Configuration Properties > General. Change Target Name to client and server respectively.
File Copying
There is a bug in VS 2010 which will sometimes prevent your newly-compiled DLLs from being copied to your mod directory. To fix it, right-click on the client and server projects in VS and select Properties. Change the Configuration drop-down menu at the top to All Configurations. Then, go to Configuration Properties > Custom Build Step and in the Additional Dependencies field, type in $(TargetPath).
IsBIK error
First, save this code to src/public/avi/ibik.h
.
Then in src/game/client/enginesprite.h
include avi/ibik.h
and add insert the hightlighted lines toward the bottom:
bool IsAVI();
bool IsBIK();
void GetTexCoordRange( float *pMinU, float *pMinV, float *pMaxU, float *pMaxV );
private:
AVIMaterial_t m_hAVIMaterial;
BIKMaterial_t m_hBIKMaterial;
Now open spritemodel.cpp
and add the following:
bool CEngineSprite::IsBIK()
{
return ( m_hBIKMaterial != BIKMATERIAL_INVALID );
}
Fixing Other Compiling Errors
- Error LNK2005: ... already defined in memoverride.obj
- For each affected project right-click on it, go to Properties->Configuration Properties->Linker->Command Line and in Additional Options add the following: "/FORCE:MULTIPLE".

- Linker Errors relating to LIBC, LIBCMT, LIBCD, LIBCMTD
- Go to the client project's Properties->Linker->Input->Ignore Specific Default Libraries and enter
libc;libcmtd;libcd;
. Navigate to the same place in the server project properties and enterlibcd;libcmtd;
. - Cannot locate "gl/glaux.h" (glview only)
- Remove the line
#include <gl/glaux.h>
fromglview.cpp
. Then right-click on the project and go to Properties->Configuration Properties->Linker->Input and under Additional Dependencies removeglaux.lib
.
Precompiled Headers
If you want to remove the "precompiled header" warnings seen during a full compile, open these files in your client project and move #include "cbase.h"
up to the first line:
- hud_locator.cpp
- hud_credits.cpp
- hud_flashlight.cpp
Compiling Under Linux
VS 2010 introduces a new project file format (.vcxproj
) which is not compatible with the SDK's VprojToMake
tool. A third-party update adding support is available.