Talk:Compiling under VS2010

From Valve Developer Community
Revision as of 23:19, 17 October 2012 by Mvmntmax (talk | contribs) (Compiling errors)

Jump to: navigation, search

Conversion Issues

I'm trying to get a mod started. I open up the project files in Visual Studio 2010. Some of the files are failing to convert. I'm getting these errors:

The platforms root directory "Q:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms" does not exist.

The following error has occurred during XML parsing: File: Q:\ModName\src\game\client\client_episodic-2005.vcproj Line: 8 Column: 2 Error Message: System error: -2146233088. The file 'Q:\ModName\src\game\client\client_episodic-2005.vcproj' has failed to load.

The following error has occurred during XML parsing: File: Q:\ModName\src\game\server\server_episodic-2005.vcproj Line: 8 Column: 2 Error Message: System error: -2146233088. The file 'Q:\ModName\src\game\server\server_episodic-2005.vcproj' has failed to load.

The platforms root directory "Q:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms" does not exist.

Anyone got any idea what would be causing this, and how to fix it? I've been pulling up nothing useful so far. -- Zhang 19:53, 2 October 2012 (PDT)

Fixing Compilation

It should be noted that it seems to have trouble with the new Execute after / before options in the custom build, i recommend using: "Execute after: PostBuildEvent"

Also, i use Environment variables to copy files to the right mod folder, makes piece of code cleaner ;) --Neico 12:18, 14 March 2010 (UTC)

If I remember right I tried using Execute After: PostBuildEvent and Execute After: Build and ran into the same problem, IE: It would sometimes decide it didn't want to copy the files, despite the fact that it was compiling changes that I had made. My alternative solution is obviously pretty inelegant. I have no idea how to use use environment variables though, I will have to look into that. -Sarkahn

I just came across a solution for the Custom Build Step not working: in the Output field, add a non-existent file path and it will always compile the Custom Build Step (this looks not like a permanent solution but does the trick for the time being) --Neico 18:41, 10 August 2010 (UTC)

After being frustrated by this problem for a long time, I discovered that it is, in fact, a VS 2010 bug, and MS is not planning on fixing it until the next release of VS. Go figure. They recommend adding $(TargetPath) to the list of Additional Dependencies as a workaround, which should make the build step do what it was intended to - only copy the DLLs after they've been modified. --Nkitten 22:59, 25 January 2011 (UTC)

Unable to Compile

When I try to Build my Mod, I get this Error

1>cl : Command line error D8016: '/ZI' and '/Ox' command-line options are incompatible

How do I fix that? --Adam.gamedev 21:15, 30 May 2010 (UTC)

Error "weapon_basesdk.h"

When i try to compile i get an error about the missing weapon_basesdk.h file (it is totally missing from the project and not resent in the directory). I'm using Source SDK 2007 with the "Start mod from scratch".

--Gravity_0 11:03, 5 July 2010 (UTC)

Compiling errors

When I tried compiling my source in VC++ 2010 Express, I get a whole bunch of these errors for various .obj files

npc_antlion.obj : error LNK2001: unresolved external symbol "void __cdecl RemoveEntityFromDarknessCheck(class CBaseEntity *)" (?RemoveEntityFromDarknessCheck@@YAXPAVCBaseEntity@@@Z)

I haven't modified the source at all except as the config articles tell be to, except I changed a

#include "ai_behavior_passenger_companion.h"

to

#include "episodic/ai_behavior_passenger_companion.h" G33k0ry 03:18, 6 January 2011 (UTC)

I'm pretty sure that RemoveEntityFromDarknessCheck is an episodic function. Are you building that project? --TomEdwards 11:39, 6 January 2011 (UTC)
Had the same problem! Make sure "HL2_EPISODIC" is only added to your "client"-Preprocessor and not the "server" one. My dll-files have eventually been copied and the project has compiled. -- mvmntmax 01:14, 18 October 2012 (CET)

Edit and Continue

Anyone got Edit and Continue working for VS2010? The option to apply code changes is simply grayed out, and if you tried to break and edit code while the game is running, VS will tell you "the source file has changed. it no longer matches the version of the file used to build the application being debugged." --Mflux 03:27, 12 April 2011 (UTC)

I've notice that when I run the project, only the server part is recompiled, so I added the client project to server project's "Project Dependencies" (right click on server project->Project Dependencies->check the client checkbox). This may help...anyway I can debug and use the "Edit adn Continue Func" now --MapleRabbit 07:55, 7 March 2012 (PST)

ERRORS

I have gotten only two errors:

1>choreoobjects.lib(choreoevent.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)

And

1>choreoobjects.lib(choreoevent.obj) : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)

I need help soon. These errors only happen in server_hl2. TheInspector 12:53, 30 April 2011 (UTC)

FORCE:MULTIPLE

I added a word of warning about that fix, its not a very good idea at all. I didn't know what it really did before. I just applied it blindly. After a while, I had multiple definitions of a couple of function, it was a nightmare to find out what wasn't working. I even wonder why that option exist in the first place... --psycommando 11:21, 20 July 2011 (PDT)

Mod doesn't run after compiles?

I have followed the instructions here for compiling the source code for both the client and server (2007), yet my mod doesn't work. I get through the videos I have added, it loads the main menu and then immediately exits. No errors, or anything... Is this a issue with compiling or what? I have refreshed the SDK since another project had the same exact problem. The compiled dlls are here[1]. --DarK St3alth 15:19, 12 February 2012 (PST)

Exactly the same problem here. I have posted on the Steam forums in the past but absolutely no-one has replied. --X6herbius 08:33, 4 June 2012 (PDT)
OK, a possible solution I may have stumbled across: (let me know if it works for you)
1. In VS2010, select Tools->Settings->Expert Settings. This will add a new "Build" menu to the top of the screen. Select Build->Rebuild Solution (normal build will only rebuild changes, which could be part of the problem). Release build has worked for me but Debug still crashes (at the point where C:\Program Files\Steam\CSERHELPER.DLL is accessed).
2. Once finished, change the SteamAppId value in your mod's gameinfo.txt to 218 (if it isn't already) and restart Steam.
This does at least get me into the main menu, though there are of course no maps to test with at the time. I'll keep investigating. --X6herbius 09:52, 4 June 2012 (PDT)