Talk:Compiling under VS2005/20090316

From Valve Developer Community
Jump to: navigation, search

Crash when selecting "Release" setting

Whenever I try to change "Debug" in the editor to "Release" the whole thing hangs and crashes. I've had other software-based problems with my graphics card (ATI Mobility Radeon HD 3650) and I was wondering if this was the same sort of thing. --X6herbius 23:55, 4 Nov 2008 (PST)

sphelper.h

When I try to compile Everything-SDK-2005, I get the following fatal error:
"fatal error C1083: Cannot open include file: './sphelper.h': No such file or directory d:\My first Mod\src\utils\phonemeextractor\phonemeextractor.cpp"
Davidkra 16:15, 30 Oct 2007 (PDT)

After searching Google it looks like sphelper.h is part of the Speech SDK
--AndrewFyfe 11:00, 14 Nov 2007 (PST)

Comments

I'll admit, I don't own VS2005, but I can't see any reason why it wouldn't be backwards compatible. --Alph Tech STUART 09:27, 17 Dec 2005 (PST)

I own it, and it's not really backwards compatible... You can convert it, but it gives you hell of warnings and errors, that's why i kept on trying to get it to compile... Here's my works result ;) --User:Rotzi
I successfully compiled using the listed instructions, but it did not run very well. I believe the heap is being corrupted, the issue seems to be present in both release and debug configurations, although it seems less evident in the release configuration. I think this may be due to hl2.exe being linked with the non-multithreaded C runtime from the 2003 version of Visual Studio. Visual Studio 2005 appears to only have multithreaded C runtimes. It may be possible to get a stable build if you can force Visual Studio 2005 to link against the libc from the Visual C++ 2003 toolkit, rather than just telling it to ignore libc. I haven't tried it, and I haven't read the toolkit license to determine if that's actually an ok thing to do. --User:MiasmicAnomie
I successfully compiled as well with Visual Studio 2005 with these instructions with 0 errors and 2 warnings for hl and 3 warnings for client, Playable, MP source.. added my results to the "Whats Working Section". Also I didn't have to do any of the rpg fixes. Happy coding. --User:digitaldrowning

Everything-SDK-2005.sln

Source SDK version as of 27 Nov 2006 (PST) includes a file Everything-SDK-2005.sln, I tried compiling it under VS2005 (which went ok until linking) and it threw 3 linker errors (LNK2019) in trace.obj and raytrace.lib. Does this file include all the source engine sdk stuff (access to graphics?) as its name suggests? How do I get it to compile correctly under VS2005? Any suggestions? Thanks for helping me out. Lenny 08:43, 27 Nov 2006 (PST)

It seems that "raytrace.lib" is compiled against an older version of certain objects than is in the latest SDK, meaning compiling VRAD on VS2005 *DOES NOT WORK EVER* unless you hexedit raytrace.lib. I'm not sure about the legalities involved in posting a fixed raytrace.lib, but for those not feint of heart: Open raytrace.lib in the VS2005 hex editor. Search "Four_Epsilons". You'll see the fully C++ name of the function, including: "...@@3U..." Change 3U to 3T, and repeat until there are no Four_Epsilons left unedited. Repeat for Four_Zeros and then for "Trace4Rays". In Trace4Rays the value is just "@@U" (becomes @@T) and is a little ways behind the functionname due to its namespace declarations and such. Once you have replaced all instances of all 3, save the lib and try recompiling vrad. If it fails, you can literally copy of the lib_vc7 version over and retry, as they are identical to start with.
Someone should turn this dangerous rambling block to some sort of a solution to those who wish to mess with the map compiling tools in VS2005 ^.^ --Nephyrin 13:11, 31 May 2007 (PDT)

Full Solutions Lists

Might not be ready for the main page, but I think I have a complete release solution for to 8/3/06 build (build 2707). It's at http://www.chatbear.com/board.plm?a=viewthread&t=429,1155740526,874&id=1001202&b=4991&v=flatold#10 let me know what you think, or post other solutions here. --Tz-Auber 23:58, 25 Aug 2006 (PDT)

Misc

I'll be getting a copy of Visual Studio 2005 (not express) in the next couple of weeks. Is there a problem compiling on it too or does anybody know yet? --AndrewNeo 07:11, 28 Jan 2006 (PST)

Yes, what i read is there are no Problems with normal, full Version of VS 05, but i had problems... same as with express. --Rotzi 4 Fe 2006 (GMT+1)

Here's a meassage I get using VC++ Express 2005 with the latest Platorm SDK and the DirectX 9 SDK-

2>c:\program files\microsoft platform sdk for windows server 2003 r2\include\winnt.h(222) : error C2146: syntax error : missing ';' before identifier 'PVOID64'
2>c:\program files\microsoft platform sdk for windows server 2003 r2\include\winnt.h(222) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft platform sdk for windows server 2003 r2\include\winnt.h(5940) : error C2146: syntax error : missing ';' before identifier 'Buffer'
2>c:\program files\microsoft platform sdk for windows server 2003 r2\include\winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\microsoft platform sdk for windows server 2003 r2\include\winnt.h(5940) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I'm not sure what the problem is, though it seems to not like the newest Platform SDK. It also does the same thing when compiling Quake 2 & 3 source as well. --Mcvoid 10:59, 4 Mar 2007 (PST)

Thats the defualt bullcrap you get when it can't figure out that a non atomic varible type (like a class) is actually a variable type and not a variable name. The rest of its errors are it complaining at you that your syntax is wrong but thats only because it doesn't understand what a 'PVOID64' is. Giving that definition should fix the problem but I HAVE no idea what it is eithier to suggest anything. --Angry Beaver 12:00, 4 Mar 2007 (PST)
If it helps at all, these are the files that are generating the errors: memoverride.cpp, KeyValues.cpp, in_mouse.cpp, in_joystick.cpp, and choreoscene.cpp. --Mcvoid 14:16, 4 Mar 2007 (PST)
Well that piece of info didn't help so much, but google did http://www.ureader.com/message/966959.aspx describse others who've had the error within other windows apps. Unfortunatley it looks like some kind of configuration/installation problem. Apart from telling you to DL and install everything again I'm not sure what would be tried. --Angry Beaver 15:35, 4 Mar 2007 (PST)
Thanks for the site. It didn't help my problem directly, but it led me to a site that led my to a site... and I ended up on the MSDN forums where a guy copied his DXSDK directory to a sub-directory under the PSDK. I think my problem was also that the PSDK include and lib directories have to be higher in the list than the DX dirs. Whatever it was, it builds now. :) --Mcvoid 09:03, 5 Mar 2007 (PST)

Other Fixes / Comments

got some info from this forumthreat

i had some errors in c_rope

fixed it once with:

taking the closing "}" from ( int iRenderCache = 0; iRenderCache < nRenderCacheCount; ++iRenderCache )

behind ++m_aRenderCache[iRenderCache].m_nCacheCount;

(means from line 231 (i think) to line 252)

i'm still trying to complete this so it will compile, hope i could help anyone...

greetz

User:Rotzi Jan 2006


grml...
doesn't work neither with express nor with full version... maybe i'm just stupid...
I'll try again this weekend and update here...
User:Rotzi Feb 2006


And still I'm having problems... Just tried it again, Release Client only, but did not get past 3 kinds of errors, wich all in all were 190 errors and 439 warnings...
I also noticed that including user32.lib and excluding LIBC did not change these error-numbers, so atleast up to that point, it did not need them... Still I'm only talking about client-Release Only.
User:Rotzi
I'd recommend /not/ using #pragma warning to disable the deprecated function comments... if you add _CRT_SECURE_NO_DEPRECATE and _CRT_NON_CONFORMING_SWPRINTFS to the preprocessor options for the projects, and then run a series of simple find/replaces across the solution (no more than about 6 - stricmp->_stricmp, __stricmp->_stricmp, strnicmp->_strnicmp, __strnicmp->_strnicmp, and a few others in similar fashion) then it actually fixes the warnings instead of just making the compiler not tell us about them. --User:Superpig

Also, a nicer fix for ..\tier1\KeyValues.cpp(800): just change the type of the variable to be a const char* instead of a char*. --User:Superpig

And again for ..\cl_dll\hud_bitmapnumericdisplay.cpp(159): Change "10" to "10.f". No need to explicitly cast it. --User:Superpig



No longer needed, just if i/we need it again... ;)

'undeclared variable'
..\cl_dll\interpolatedvar.h(538)
..\public\sentence.cpp(735)
..\public\sentence.cpp(1098)
..\public\sentence.cpp(1168)

Valves compatible version

User:Mosca

I always hear about valve porting the sdk to VS2005, does any one has news on that, or we should wait until after EP1?



Yes and it should have been time for several months... but doesn't seem Valve will get it working at all -.- I think this sucks.
Why do they tell us they'll release it in about 3 months. Was that a year ago now? Check out Microsofts game coding for fun page.
"Since the RTM release in November, we do have an update from Valve – "Valve is working hard on ensuring support for Visual C++ Express and expect to have an update very soon for the Source SDK that will enable modding using Visual C++ Express Edition."
As they say 2003 suggested and 2005 not supported, i think the comment on the 05 express goes for VS2005 as well...
greetings User:Rotzi


According to sources I have come across there is a bit of a dilemma. Microsoft has been releasing their Express editions for free for the last eight months, and that puts them starting the released in November... their terms are that it is free to download and thereby own for a year. Once the year is up you can use it continued, owning it, but it will then be converted over to be sold ballpark $50 US.
If you look at what valve has been saying, there looks to be an imminent release of the source code updated to work on VS2005 around November.
It’s a bit shady, but there have been a number of people who have already downloaded the application. It’s more that Microsoft & Valve seem to have talked this over and decided to wait for whatever monetary reasons. It would however appear to be in valves favor to appeal to the mod community, and it is rather clear as to how having a free coding environment would effect the community. I have taken to updating my code base, in my spare time only, to the new environment, which has been a week in the works, and all the more daunting, in comparison to how smooth the 2003.net studio compiles the code. It is just a matter of time until they get their systems working. I only hope that their "free tools" ideal does not fall apart to the oncoming updated games. Source has some very fun games/mods, but their development structure is far from sound.
- ImaTard 12:50, 7 Jun 2006 (PDT)
The Express versions are all free, and are going to remain that way. - RodeoClown 23:02, 21 Aug 2006 (PDT)
Just checked that, HELL YES!!!
Take a look at this press text from Microsoft.
The Express Versions will definately remain for free. greetings -- Rotzi 08:11, 22 Aug 2006 (PDT)

Question

Hi there, not sure where to put this so I'll try here. There is an error I'm receiving after following the tutorial steps from the Wiki tutorial on creating a panel (http://developer.valvesoftware.com/wiki/VGUI2:_Creating_a_panel) I am receiving the following error when trying to build Game_sdk:

fatal error C1010 - unexpected end of file while looking for precompiled header directive.

This occurs in the mypanel.cpp file.

I am assuming this has something to do with the client.pch precompiled header file? Although all this does in include CBase.h?

Please help as soon as possible as the project is due for University on 16th June 2006.

OUTDATED

Most of this is outdated due to release of new version of SDK that fixes all problems with VS2005. Marek Sieradzki 01:21, 9 Dec 2006 (PST)


The newest update to the SDK apparently broke something, not sure what without debugging really deep- compiles fine, but when doing a mod from scratch and loading a level I'm getting memory read errors, different address' each time. Anyone else having this problem?

Here's the console output, just the problems:

Host_Error: IDLLFunctions::DLLInit returned false.
CGameEventManager::AddListener: event 'hltv_status' unknown.
CGameEventManager::AddListener: event 'game_newmap' unknown.
Hud element 'CHudVoiceStatus' doesn't have an entry 'HudVoiceStatus' in scripts/HudLayout.res
Hud element 'CHudVoiceSelfStatus' doesn't have an entry 'HudVoiceSelfStatus' in scripts/HudLayout.res
CGameEventManager::AddListener: event 'player_team' unknown.
CGameEventManager::AddListener: event 'game_newmap' unknown.
CGameEventManager::AddListener: event 'hltv_cameraman' unknown.
CGameEventManager::AddListener: event 'hltv_fixed' unknown.
CGameEventManager::AddListener: event 'hltv_chase' unknown.
CGameEventManager::AddListener: event 'hltv_fov' unknown.
CGameEventManager::AddListener: event 'hltv_inertia' unknown.

--Wretched 15:58, 18 Mar 2007 (PDT)

4/10/07 -> There have been no comments on this lately so I get the feeling I am doing something wrong. Here is the situation though: I have Visual Studio 2005 professional edition, and have tried to build and run:

* A modified "mod from scratch"
* A modified "HL2 Single Player mod"
* An unmodified "mod from scratch"
* An unmodified "HL2 Single Player mod"

They all seem to build just fine with 0 errors and 3 or so neglegent warnings about debuggers. However when I try to run any of them the game starts up, and the "startup videos" play like normal but then the main menu screen flashes for an instant and the game crashes to the desktop. Any thoughts, solutions, or ideas? Unsigned comment added by G.I. Jimbo (talkcontribs) Always sign your posts with four tildes (~~~~)

There are two things to check:
  • Have you done the Refresh SDK Content option in the Source SDK menu before creating the mod?
  • Have you set the build to Release HL2 (it is set to Debug HL2 first) - I've never been able to get the Debug HL2 build to work, but Release HL2 does.
--Daedalus 01:41, 11 Apr 2007 (PDT)
Had this bug too. It's simply fixed by placing the required script files inside your mod. Try copy these from a similer mod. Or even the original game. --Sortie 11:00, 11 Apr 2007 (PDT)
I haven't had to do that. Could you provide the names of the files/folders so that Jimbo can copy them, please? --Daedalus 17:47, 11 Apr 2007 (PDT)
Alright, thanks for reminding me to do that Daedalus, the Game_Scratch-2005 compiled and at least ran this time, but now the Custom game logo doesn't show up. I understand that this problem is something to be posted in an entirely different topic though, so thanks again for the reminder.
The logo is defined in some script file, but I'm not sure. Havn't played around with it, yet. :D --Sortie 02:45, 13 Apr 2007 (PDT)

cannot find file

When compiling the code in VS2005, it keeps giving me this message:

"fatal error C1083: Cannot open include file: 'windows.h': No such file or directory"

How can I fix this?

ARGH, not at you but at the communities inaction to update this article. We need someone to sit down with a fresh install of steam and the SDK and nothing else and try and compile under VS 2005 and list the issues top to bottom and what they did to fix them. If you only install the 2005 Express your still missing things like the direct X SDK and or the windows SDK. and then how do you add them. I've got a full blown install of 2005 that came with every bell and whistle so I never had an issue so I can't write that guide unless I wanna format my computer for craps and giggles. Oh and by the way your answer on what to try is in the middle of my rant :P --Angry Beaver 19:51, 19 Dec 2006 (PST)

You need to download and install the microsoft DX SDK and the microsoft platform SDK. The links are somewhere in this part of the wiki. Solokiller 06:24, 20 Dec 2006 (PST) Here are the links:

I have updated the page to reflect what is needed for Express now, after going over it with a guy in #wavelength. He has it compiled and working now, just requires both SDKs and a change to the dependancies (adding user32.lib) -- NuclearFriend 06:35, 20 Dec 2006 (PST)

I downloaded the all the different SDKs now, and hopefully it will work. What this site needs is just a simple link in the modding section that lists the basic required programs for mod-making. I don't even remember where the page was that said I needed the DirectX SDK, something I thought I didn't even need...

Now, it can't compile anything for SP and only the client.dll for MP. I don't really care about the SP problems, but for MP, it gives me these errors:

"Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)

Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__SendMessageA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)

Editor_SendCommand.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z)

registry.obj : error LNK2019: unresolved external symbol __imp__wsprintfA referenced in function "public: virtual bool __thiscall CRegistry::DirectInit(char const *)" (?DirectInit@CRegistry@@UAE_NPBD@Z)

Debug HL2MP/server.dll : fatal error LNK1120: 4 unresolved externals"

sniprpenguin

You need to add the linker dependencies in, looks like user32.lib. --Wretched 16:00, 18 Mar 2007 (PDT)

Newer versions of DX SDK?

I have VC++ 2005 and I'm about to install the DX SDK for June '07. I'm just wondering, it mentions the 2005 December one on the main page so will there be incompatibility problems using the newer one? Thanks in advance, Tomos

I doubt it --Angry Beaver 12:30, 16 Sep 2007 (PDT)

DirectX SDK unnecessary?

I've compiled many times without the DirectX SDK (with the Platform SDK though, of course) without any warnings or errors. Is it actually necessary? I think it may be that it's only necessary when compiling Everything_SDK, instead of just Game_Scratch (or what have you); I've only ever compiled on the latter. --Kohan 15:34, 22 Oct 2007 (PDT)

yes the directx sdk is only needed when compiling some items in the everything_sdk and custom/example shaders. --Stevenm64 07:33, 23 Oct 2007 (PDT)

VC++ Directories

Just like to point this out. I had some trouble when switching to Windows Vista and the Windows SDK, I couldn't get my VC++ 2005 compiling again. Problem was, I was adding the following in the Directories:

F:\Program Files\Microsoft SDKs\Windows\v6.0\Lib\x86

When I should have simply been adding:

F:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

Hope that helps. --Dave1271 08:36, 7 Jun 2008 (PDT)




Whenever I compile I get this error, help? :( == ==


1>------ Build started: Project: client_hl2mp, Configuration: Release HL2MP Win32 ------ 2>------ Build started: Project: server_hl2mp, Configuration: Release HL2MP Win32 ------ 1>Linking... 2>Linking... 2>choreoobjects.lib(choreoevent.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 1>tier2.lib(tier2.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 2> Creating library Release HL2MP/server.lib and object Release HL2MP/server.exp 2>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 2>editor_sendcommand.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z) 2>editor_sendcommand.obj : error LNK2019: unresolved external symbol __imp__SendMessageA@16 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z) 2>editor_sendcommand.obj : error LNK2019: unresolved external symbol __imp__FindWindowA@8 referenced in function "enum EditorSendResult_t __cdecl Editor_SendCommand(char const *,bool)" (?Editor_SendCommand@@YA?AW4EditorSendResult_t@@PBD_N@Z) 1> Creating library Release HL2MP/client.lib and object Release HL2MP/client.exp 2>registry.obj : error LNK2019: unresolved external symbol __imp__wsprintfA referenced in function "public: virtual bool __thiscall CRegistry::DirectInit(char const *)" (?DirectInit@CRegistry@@UAE_NPBD@Z) 1>in_mouse.obj : error LNK2019: unresolved external symbol __imp__SystemParametersInfoA@16 referenced in function "public: virtual void __thiscall CInput::ActivateMouse(void)" (?ActivateMouse@CInput@@UAEXXZ) 1>Release HL2MP/client.dll : fatal error LNK1120: 1 unresolved externals 2>Release HL2MP/server.dll : fatal error LNK1120: 4 unresolved externals 1>Build log was saved at "file://d:\MissionR\src\cl_dll\Release HL2MP\BuildLog.htm" 1>client_hl2mp - 2 error(s), 1 warning(s) 2>Build log was saved at "file://d:\MissionR\src\dlls\Release HL2MP\BuildLog.htm" 2>server_hl2mp - 5 error(s), 2 warning(s)

==== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ====

"MyMod" Crashes To Desktop - No Errors

Hi all, I hope I've got this right as I've never made a subject or anything on a wiki. So, here I go:

I can compile the Game_Episodic-2005 project (both debug and release) with no errors or warnings and it puts the client.dll and server.dll into the correct directories. But when I go to run my mod (Entitled "MyMod" - I have made no changes to the code or anything), it will play the initial Valve video then - on trying to get to the main menu - crash straight to desktop, no error. If I run it in debug or dev mode, it doesn't run at all.

I've tried the fixes in this wiki article and get exactly the same result. Google doesn't seem to be my friend here, as nobody looks to have this problem.

Could someone please tell me where I'm going wrong? I've run out of ideas.

Thanks,

--Wolfeh 1st Sept 2008

Linking against kernel32.lib?

I seem to not having to link against kernel32.lib with my VS2005 Express - can I get confirmation on this? --z33ky 19:45, 25 Oct 2008 (PDT)

It's the same case for me. --Vicpop 11:06, 26 Oct 2008 (PDT)

Better tutorial to follow?

MS Platform SDK Install steps Found this while messing around with OGRE-- this seems like it'd be better, you don't have to include the dependencies for each project..? --Vicpop 11:06, 26 Oct 2008 (PDT)

Simply depends on your likings. I guess it wouldn't hurt to like to that page though.. --z33ky 07:23, 28 Oct 2008 (PDT)