Source Compile

tehrilez

New Adventurer
Joined
Aug 3, 2007
Messages
776
Reaction score
0
Age
30
Location
USA, NY
Wasnt sure where this was supposed to go.. but I needed help so Im trying support.


THIS IS FOR SOURCE.


I'm getting some compile errors. Some errors based on my part, nonetheless. Help is appreciated.

1>------ Build started: Project: server_hl2mp, Configuration: Debug HL2MP Win32 ------
2>------ Build started: Project: client_hl2mp, Configuration: Debug HL2MP Win32 ------
1>Compiling...
1>stdafx.cpp
2>Compiling...
2>stdafx.cpp
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(179) : error C2535: 'const int CPlayerInfo::GetArchery(void)' : member function already defined or declared
1> c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(174) : see declaration of 'CPlayerInfo::GetArchery'
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C2146: syntax error : missing ';' before identifier 'GetPlayerName'
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C2433: 'CPlayerInfo::string' : 'virtual' not permitted on data declarations
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : warning C4183: 'GetPlayerName': missing return type; assumed to be a member function returning 'int'
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(134) : error C2758: 'CPlayerInfo::string' : must be initialized in constructor base/member initializer list
1> c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : see declaration of 'CPlayerInfo::string'
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 8.00.50727
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>BSCMAKE: error BK1506 : cannot open file '.\debug hl2mp\AI_Activity.sbr': No such file or directory
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(141) : error C2146: syntax error : missing ';' before identifier 'GetPlayerName'
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(141) : error C2433: 'C_BasePlayer::string' : 'virtual' not permitted on data declarations
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(141) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(141) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(141) : warning C4183: 'GetPlayerName': missing return type; assumed to be a member function returning 'int'
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(416) : error C2146: syntax error : missing ';' before identifier 'ms_playerName'
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(416) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Build log was saved at "file://c:\Program Files\Steam\steamapps\SourceMods\Master Sword Source\src\dlls\Debug HL2MP\BuildLog.htm"
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(416) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(128) : error C2065: 'ms_AxeHandling' : undeclared identifier
1>server_hl2mp - 7 error(s), 1 warning(s)
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(129) : error C2065: 'ms_BluntArms' : undeclared identifier
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(142) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
2>Creating browse information file...
2>Microsoft Browse Information Maintenance Utility Version 8.00.50727
2>Copyright (C) Microsoft Corporation. All rights reserved.
2>BSCMAKE: error BK1506 : cannot open file '.\debug hl2mp\AlphaMaterialProxy.sbr': No such file or directory
2>Build log was saved at "file://c:\Program Files\Steam\steamapps\SourceMods\Master Sword Source\src\cl_dll\Debug HL2MP\BuildLog.htm"
2>client_hl2mp - 10 error(s), 2 warning(s)
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Even my meager coding skillz can get most of these:
Code:
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(179) : error C2535: 'const int CPlayerInfo::GetArchery(void)' : member function already defined or declared
1> c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(174) : see declaration of 'CPlayerInfo::GetArchery'
Ye defined something twice.

Code:
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Ye have an undeclared variable.

Code:
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : error C2146: syntax error : missing ';' before identifier 'GetPlayerName'
Ye forgot a “;” on or around line 186 of player.h. (#1 nub mistake, I do it all the effing time.)

99% likehood that all subsequent errors are a result of this, so it’s not really bother going over most of the others.

Code:
1>c:\program files\steam\steamapps\sourcemods\master sword source\src\dlls\player.h(186) : warning C4183: 'GetPlayerName': missing return type; assumed to be a member function returning 'int'
Could be the “;” terminator issue, but could also be you are trying to return the wrong type of data from a function.

Most of these other server-side errors seem to be simply results of the above.

As for the client side errors… (c_baseplayer.h) – I’m guessing somehow your client and server are sharing a file that player.h includes – as they seem to be similar issues. MSC does this a lot – but I think ye may wish to avoid it insomuch as you can, as it makes it harder to modify one without messing with the other. Server side patches are easier to distribute too, so in the future it makes fixes easier, if your client and server share as little of the same code as possible.

Code:
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(416) : error C2146: syntax error : missing ';' before identifier 'ms_playerName'
Yeah, that again. “;” – or C++ doesn’t know where the line ends. Again, everything after that is probably a result of this error.

Code:
2>c:\program files\steam\steamapps\sourcemods\master sword source\src\cl_dll\c_baseplayer.h(142) : warning C4800: 'const int' : forcing value to bool 'true' or 'false' (performance warning)
Again, could be the “;” terminator, but also could be you are using the wrong data type.

After you get a group of errors like this in VS2003, click on TASKS - you should have a list of all the errors - double clicking on any one of them will, usually, take you right to the line with the issue. Good for silly little errors like missing semi-colons - but useless for more complex things like linking issues.
 

tehrilez

New Adventurer
Joined
Aug 3, 2007
Messages
776
Reaction score
0
Age
30
Location
USA, NY
this is line 186

virtual const bool GetGender();

it has a ;
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
...and the line before it, and after? - Gotta remember C++ doesn't actually know where the line ends. (And I won't ask if you can have a virtual constant boolean)
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
Aye - Generally when compilers give the line number for a missing ';', it's the line before that's actually missing it ;-)
 

tehrilez

New Adventurer
Joined
Aug 3, 2007
Messages
776
Reaction score
0
Age
30
Location
USA, NY
virtual const int GetParryExp();
virtual const string GetPlayerName();
virtual const bool GetGender();
virtual const int GetPlayersKills();
virtual const int GetGold();


they all have them..
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Then my next guess is... Can you setup a virtual const that is also a variable? I've never seen that before. :/ Is it an HL2SDK thang?
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
And who has the nads to make Gender a boolean?

"Males are true" - You
"AW HELL NO!" - Women

:oldlol:
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
Maybe you can assign constant variables with functions, but don't you need a variable name in there...?

vitrual const int parryExp GetParryExp(); ?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
But... Why is it const? Tis what I don't get. I've never seen virtual used that way.

Usually it's:
virtual datatype SomeFuncName( SomeFuncType )

So fer instance:
Code:
virtual void KeyValue( KeyValueData *pkvd );
virtual int	ObjectCaps( void ) 
virtual BOOL IsTogglePlat( void ) { return (pev->spawnflags & SF_PLAT_TOGGLE) ? TRUE : FALSE; }

etc. etc. const + variable datatype just seems paradoxal to me, but *shrug* it maybe just I've never seen it done like that and it's perfectly fine.

Other possiblity is you have some odd character in your code making it miss the terminator, but I doubt it.

MSDN said:
The virtual keyword declares a virtual function or a virtual base class.

virtual member-function-declarator
virtual [access-specifier] base-class-name
The elements of a virtual declaration are as follows:

member-function-declarator
Declares a member function.
access-specifier
Defines the level of access to the base class. Can appear before or after the virtual keyword.
base-class-name
Identifies a previously declared class type.
See Virtual Functions and Virtual Base Classes for more information. Also see the following keywords: class, private, public, and protected.

Useless as usual. I miss the old days of the good old reference CHM file - that thing actually had useful info.

PS. This should really be in Source Chatter, but at least here if someone hijacks it I can fix it.
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
Yer asking the wrong guy for programming questions above basic levels ;-)
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Virtuals are basic... But again, I've just never seen them used like that.

MSDN said:
A virtual function is a member function that you expect to be redefined in derived classes. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class's version of the function.
Virtual functions ensure that the correct function is called for an object, regardless of the expression used to make the function call.
Suppose a base class contains a function declared as virtual and a derived class defines the same function. The function from the derived class is invoked for objects of the derived class, even if it is called using a pointer or reference to the base class. The following example shows a base class that provides an implementation of the PrintBalance function and two derived classes
Code:
// deriv_VirtualFunctions.cpp
// compile with: /EHsc
#include <iostream>
using namespace std;

class __declspec(dllexport) Account
{
public:
   Account( double d );  // Constructor.
   virtual double GetBalance();         // Obtain balance.
   virtual void   PrintBalance();       // Default implementation.
private:
    double _balance;
};

// Implementation of constructor for Account.
Account::Account( double d )
{
   _balance = d;
}

// Implementation of GetBalance for Account.
double Account::GetBalance()
{
   return _balance;
}
// Default implementation of PrintBalance.
void Account::PrintBalance()
{
   cerr << "Error. Balance not available for base type."
        << endl;
}

class __declspec(dllexport) CheckingAccount : public Account
{
public:
   void PrintBalance();
};

// Implementation of PrintBalance for CheckingAccount.
void CheckingAccount::PrintBalance()
{
   cout << "Checking account balance: " << GetBalance();
}

class __declspec(dllexport) SavingsAccount : public Account
{
public:
   void PrintBalance();
};

// Implementation of PrintBalance for SavingsAccount.
void SavingsAccount::PrintBalance()
{
   cout << "Savings account balance: " << GetBalance();
}

int main()
{
}
MSDN_continued… said:
The PrintBalance function in the derived classes is virtual because it is declared as virtual in the base class, Account. To call virtual functions such as PrintBalance, code such as the following can be used:
Code:
// Create objects of type CheckingAccount and SavingsAccount.
CheckingAccount *pChecking = new CheckingAccount( 100.00 );
SavingsAccount  *pSavings  = new SavingsAccount( 1000.00 );

// Call PrintBalance using a pointer to Account.
Account *pAccount = pChecking;
pAccount->PrintBalance();

// Call PrintBalance using a pointer to Account.
pAccount = pSavings;
pAccount->PrintBalance();
MSDN_continues said:
In the preceding code, the calls to PrintBalance are identical, except for the object pAccount points to. Because PrintBalance is virtual, the version of the function defined for each object is called. The PrintBalance function in the derived classes CheckingAccount and SavingsAccount "override" the function in the base class Account.
If a class is declared that does not provide an overriding implementation of the PrintBalance function, the default implementation from the base class Account is used.
Functions in derived classes override virtual functions in base classes only if their type is the same. A function in a derived class cannot differ from a virtual function in a base class in its return type only; the argument list must differ as well.
When calling a function using pointers or references, the following rules apply:
• A call to a virtual function is resolved according to the underlying type of object for which it is called.
• A call to a nonvirtual function is resolved according to the type of the pointer or reference.
The following example shows how virtual and nonvirtual functions behave when called through pointers:
Code:
// deriv_VirtualFunctions2.cpp
// compile with: /EHsc

class __declspec(dllimport) Account
{
public:
                   Account( double d );  // Constructor.
    virtual double GetBalance();         // Obtain balance.
    virtual void   PrintBalance();       // Default implementation.
private:
    double _balance;
};

class __declspec(dllimport) CheckingAccount : public Account
{
public:
    void PrintBalance();
};

class __declspec(dllimport) SavingsAccount : public Account
{
public:
    void PrintBalance();
};


#include <iostream>

using namespace std;
// Declare a base class.
class Base
{
public:
    virtual void NameOf();          // Virtual function.
            void InvokingClass();   // Nonvirtual function.
};

// Implement the two functions.
void Base::NameOf()
{
    cout << "Base::NameOf\n";
}

void Base::InvokingClass()
{
    cout << "Invoked by Base\n";
}

// Declare a derived class.
class Derived : public Base
{
public:
    void NameOf();          // Virtual function.
    void InvokingClass();   // Nonvirtual function.
};

// Implement the two functions.
void Derived::NameOf()
{
    cout << "Derived::NameOf\n";
}

void Derived::InvokingClass()
{
    cout << "Invoked by Derived\n";
}

int main()
{
    // Declare an object of type Derived.
    Derived aDerived;
    // Declare two pointers, one of type Derived * and the other
    //  of type Base *, and initialize them to point to aDerived.
    Derived *pDerived = &aDerived;
    Base    *pBase    = &aDerived;
    // Call the functions.
    pBase->NameOf();           // Call virtual function.
    pBase->InvokingClass();    // Call nonvirtual function.
    pDerived->NameOf();        // Call virtual function.
    pDerived->InvokingClass(); // Call nonvirtual function.
}
Code:
Output
Derived::NameOf
Invoked by Base
Derived::NameOf
Invoked by Derived
How_much_MSDN_Can_Thothie_Quote_Before_he_gets_sued said:
Note that regardless of whether the NameOf function is invoked through a pointer to Base or a pointer to Derived, it calls the function for Derived. It calls the function for Derived because NameOf is a virtual function, and both pBase and pDerived point to an object of type Derived.
Because virtual functions are called only for objects of class types, you cannot declare global or static functions as virtual.
The virtual keyword can be used when declaring overriding functions in a derived class, but it is unnecessary; overrides of virtual functions are always virtual.
Virtual functions in a base class must be defined unless they are declared using the pure-specifier. (For more information about pure virtual functions, see Abstract Classes.)
The virtual function-call mechanism can be suppressed by explicitly qualifying the function name using the scope-resolution operator :):). Consider the earlier example involving the Account class. To call PrintBalance in the base class, use code such as the following:
Code:
CheckingAccount *pChecking = new CheckingAccount( 100.00 );

pChecking->Account::PrintBalance();  //  Explicit qualification.

Account *pAccount = pChecking;  // Call Account::PrintBalance

pAccount->Account::PrintBalance();   //  Explicit qualification.
MSDN_cease_and_desist said:
Both calls to PrintBalance in the preceding example suppress the virtual function-call mechanism.

Tell me if you have the MSDN and I'm just wasting my breath quoteing - but basically, that's all the info I have on virtuals.
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
I have yet to use Virtuals, as I don't know that they're even in Java, which is my main language. I think I have the MSDN on the CD ya sent or maybe in the VS2k5 CDs, but even if I don't, you don't need to bother posting all this ;-) I'm mostly working on other things, anyway.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
MSDN won't fit on a CD. Tis like 7 Gigs.

...sadly I find it about 1/10th as useful as the 50MB CHM we used pre-VS 6.0. - Tis, in fact, one of several reasons why I still use VB5, even though I have VB6 in VS2003.
 

The Man In Black

Administrator
Staff member
Administrator
Moderator
RiP
Joined
Jul 9, 2006
Messages
6,904
Reaction score
71
Well, I think I saw the words "MSDN" on a few of the VS2k5 CDs. I thought you mentioned something about it before you got me 2k3, but maybe I'm just remembering you saying something like "If you want the MSDN, too bad." :p
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Yeah - the VS2003 has an install the MSDN option, but if you click it it bjorks on you, because you do not have CD #1 of 30, or whatever it is, or a $700/month subscription to the on-line service that produces mostly useless info, as seen on the previous page.

Granted, it also, sometimes gives you third-party programing examples (more so in the VS2005 MSDN) - but you can get that on Google, and the ones on Google are often better.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Fix my Steam before I gotta placate the alien, evidentially. *sigh* 'night. I shall hopefully get things working tomorrow, as I won't be home for several days after that, and no Steam kinda limits the sort of MSC dev stuff I can do.
 
Top