Reputation: 1
i want to compile a php code to dll,i'm new on this creations things,but i need this file to be dll.
Here is the code i need to compile to dll :
#include "Stdafx.h"
#include "Post.h"
void DataSendAll(unsigned char* Packet, int Length)
{
for (int i=6400; i<7400; i++)
if(gObjIsConnected(i))
DataSend(i, Packet, Length);
}
void SendPost(int wId, LPCSTR Command, LPCSTR Text)
{
if (IsPost != 1) return;
if (!gObjIsConnected(wId)) return;
if (!strcmpi(Command, "/Post"))
{
MessageOutput(wId, "[%s] Useage: /Post <Msg>.", szPrefix);
MessageOutput(wId, "[%s] Price for post: %d, Minimun Level: %d", szPrefix, PostCost,
`PostLevel);
return;
}
gObj_SetInfo(wId);
if (gObj.Level < PostLevel)
{
MessageOutput(wId, "[%s] You're level is too low to post!", szPrefix);
return;
}
if (gObj.Money < PostCost)
{
MessageOutput(wId, "[%s] You don't have enough money to post!", szPrefix);
return;
}
BYTE *Packet;
char Message[100];
Packet = (BYTE*) malloc(200);
memset(Packet, 0x00, 200);
*Packet = 0xC1;
*(Packet+2) = 0x00;
memcpy((Packet+3), gObj.Nick, strlen(gObj.Nick));
sprintf(Message, "@@[Global] %s", Text);
memcpy((Packet+13), Message, strlen(Message));
int Len = (strlen(Message) + 0x13);
*(Packet+1) = Len;
DataSendAll(Packet, Len);
int Amount = (gObj.Money - PostCost);
gObj_Write(wId, gObj_Money, Amount);
MoneySend(wId, Amount);
free (Packet);
}
But it's giving me this errors when i try to build :
------ Build started: Project: Post, Configuration: Debug Win32 ------
Compiling...
Post.cpp
.\Post.cpp(6) : error C3861: 'gObjIsConnected': identifier not found
.\Post.cpp(7) : error C3861: 'DataSend': identifier not found
.\Post.cpp(10) : error C2061: syntax error : identifier 'LPCSTR'
.\Post.cpp(12) : error C2065: 'IsPost' : undeclared identifier
.\Post.cpp(13) : error C3861: 'gObjIsConnected': identifier not found
.\Post.cpp(14) : error C2065: 'Command' : undeclared identifier
.\Post.cpp(14) : error C3861: 'strcmpi': identifier not found
.\Post.cpp(16) : error C2065: 'szPrefix' : undeclared identifier
.\Post.cpp(16) : error C3861: 'MessageOutput': identifier not found
.\Post.cpp(17) : error C2065: 'szPrefix' : undeclared identifier
.\Post.cpp(17) : error C2065: 'PostCost' : undeclared identifier
.\Post.cpp(17) : error C2065: 'PostLevel' : undeclared identifier
.\Post.cpp(17) : error C3861: 'MessageOutput': identifier not found
.\Post.cpp(20) : error C3861: 'gObj_SetInfo': identifier not found
.\Post.cpp(21) : error C2065: 'gObj' : undeclared identifier
.\Post.cpp(21) : error C2228: left of '.Level' must have class/struct/union
type is ''unknown-type''
.\Post.cpp(21) : error C2065: 'PostLevel' : undeclared identifier
.\Post.cpp(23) : error C2065: 'szPrefix' : undeclared identifier
.\Post.cpp(23) : error C3861: 'MessageOutput': identifier not found
.\Post.cpp(26) : error C2065: 'gObj' : undeclared identifier
.\Post.cpp(26) : error C2228: left of '.Money' must have class/struct/union
type is ''unknown-type''
.\Post.cpp(26) : error C2065: 'PostCost' : undeclared identifier
.\Post.cpp(28) : error C2065: 'szPrefix' : undeclared identifier
.\Post.cpp(28) : error C3861: 'MessageOutput': identifier not found
.\Post.cpp(31) : error C2065: 'BYTE' : undeclared identifier
.\Post.cpp(31) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(33) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(33) : error C2065: 'BYTE' : undeclared identifier
.\Post.cpp(33) : error C2059: syntax error : ')'
.\Post.cpp(34) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(34) : error C3861: 'memset': identifier not found
.\Post.cpp(35) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(36) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(37) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(37) : error C2065: 'gObj' : undeclared identifier
.\Post.cpp(37) : error C2228: left of '.Nick' must have class/struct/union
type is ''unknown-type''
.\Post.cpp(37) : error C2065: 'gObj' : undeclared identifier
.\Post.cpp(37) : error C2228: left of '.Nick' must have class/struct/union
type is ''unknown-type''
.\Post.cpp(37) : error C3861: 'memcpy': identifier not found
.\Post.cpp(37) : error C3861: 'strlen': identifier not found
.\Post.cpp(38) : error C2882: 'Text' : illegal use of namespace identifier in expression
.\Post.cpp(38) : error C3861: 'sprintf': identifier not found
.\Post.cpp(39) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(39) : error C3861: 'memcpy': identifier not found
.\Post.cpp(39) : error C3861: 'strlen': identifier not found
.\Post.cpp(40) : error C3861: 'strlen': identifier not found
.\Post.cpp(41) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(42) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(43) : error C2065: 'gObj' : undeclared identifier
.\Post.cpp(43) : error C2228: left of '.Money' must have class/struct/union
type is ''unknown-type''
.\Post.cpp(43) : error C2065: 'PostCost' : undeclared identifier
.\Post.cpp(44) : error C2065: 'gObj_Money' : undeclared identifier
.\Post.cpp(44) : error C3861: 'gObj_Write': identifier not found
.\Post.cpp(45) : error C3861: 'MoneySend': identifier not found
.\Post.cpp(46) : error C2065: 'Packet' : undeclared identifier
.\Post.cpp(46) : error C3861: 'free': identifier not found
Build log was saved at "file://c:\Documents and Settings\Mihai\Desktop\Folder nou\Post\Post\Debug\BuildLog.htm"
Post - 56 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What i need to do?
What should i do to make it working.
I am using : Visual C++ 2008 Express Edition
.
Upvotes: 0
Views: 553
Reputation: 24606
.\Post.cpp(6) : error C3861: 'gObjIsConnected': identifier not found
means the compiler does not know what you mean by gObjIsConnected
. It looks like you are calling a function or function object there, but since you don't show an SSCCE one can only guess that it is declared in some header that has not been included. Include the appropiate header and the error should disappear.
Same goes for DataSend
and many of the other identifier not found
messages.
.\Post.cpp(10) : error C2061: syntax error : identifier 'LPCSTR'
This one is just a slight bit different, as it is not a function or variable. You are using LPCSTR
like a type here, but the compiler does not know that it's a type. The reason will be similar to the other errors: you failed to include the header that defines that type (I fear its one of the WinAPI headers)
The reason for the rest is pretty the same. Include the missing headers, and most of your errors will disappear.
Upvotes: 1