2013-08-16 2 views
0

나는 dll에 PHP 코드를 컴파일하고 싶다. 나는이 생성물에 대해 새로운 것이지만이 파일이 dll이어야한다. 여기 C++에서 약간의 에러에 대해

내가 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); 
} 

그러나 내가 빌드 할 때 그것은 나를이 오류를주고 :

------ 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 ========== 

내가해야 할 일은?

어떻게 작동시켜야합니까?

저는 Visual C++ 2008 Express Edition입니다.

+4

.... PHP 코드는 어디에 있습니까? – andrewsi

+0

그 긴 문자열은 무엇입니까? 그것의 문자열은 아니지만'backquote'로 시작합니다. – DevZer0

답변

1

\ Post.cpp가 (6) :. 오류 C3861 : 'gObjIsConnected': 식별자가

발견되지는 컴파일러가 당신이 gObjIsConnected 무슨 뜻인지 알 수 없습니다 것을 의미합니다. 거기에 함수 나 함수 객체를 호출하는 것처럼 보이지만, SSCCE을 표시하지 않으므로 포함되지 않은 일부 헤더에서만 선언 된 것으로 추측 할 수 있습니다. 적절한 헤더를 포함 시키면 오류가 사라집니다.

같은 내용은 DataSend과 다른 많은 identifier not found 메시지입니다.

\ Post.cpp (10). 에러 C2061 : 구문 오류 :이 함수 또는 변수 아니므로 식별자 'LPCSTR'

이 것은 단지 약간 약간 다르다. LPCSTR 같은 형식을 사용하지만 컴파일러는 형식인지 여부를 알 수 없습니다. 이유는 다른 오류와 유사합니다. 해당 유형을 정의하는 헤더를 포함하지 못했습니다 (WinAPI 헤더 중 하나를 두려워합니다).

나머지 이유는 거의 같습니다. 누락 된 헤더를 포함 시키면 대부분의 오류가 사라집니다.

관련 문제