Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/11/2008, 08:44
soymanya
 
Fecha de Ingreso: noviembre-2008
Mensajes: 3
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Errores en codigo

1) venkman, si agrego el ; me salen 20 errores.
Que son estos: Post.cpp
Código:
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(19) : error C2065: 'gObjIsConnected' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(20) : error C2065: 'DataSend' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(26) : error C2065: 'IsPost' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(30) : error C2065: 'MessageOutput' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(30) : error C2065: 'szPrefix' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(31) : error C2065: 'PostCost' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(31) : error C2065: 'PostLevel' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(34) : error C2065: 'gObj_SetInfo' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(35) : error C2065: 'gObj' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(35) : error C2228: left of '.Level' must have class/struct/union type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(40) : error C2228: left of '.Money' must have class/struct/union type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(47) : error C2065: 'malloc' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(51) : error C2228: left of '.Nick' must have class/struct/union type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(51) : error C2228: left of '.Nick' must have class/struct/union type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(52) : error C2065: 'sprintf' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(57) : error C2228: left of '.Money' must have class/struct/union type
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(58) : error C2065: 'gObj_Write' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(58) : error C2065: 'gObj_Money' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(59) : error C2065: 'MoneySend' : undeclared identifier
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(60) : error C2065: 'free' : undeclared identifier
Error executing cl.exe.

Post.dll - 20 error(s), 0 warning(s)
2) Eternal Idol: No entendi lo que dijiste, la verdad todavia no se mucho de C++, me podrias decir bien donde esta el error, gracais.

Aca dejo todo lo que hice:

cree el Post.cpp con este codigo:
Código:
// Post.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    return TRUE;
}

__declspec(dllexport) LPCTSTR RetrievePost(LPCTSTR szDirectory, LPCTSTR szPrefix);

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) 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);
}
2) cree un text file le puse "Export.def" y le puse lo siguiente:
Código:
LIBRARY Post
EXPORTS
     RetrievePost
Si le saco el ; despues de esta linea:
Código:
__declspec(dllexport) LPCTSTR RetrievePost(LPCTSTR szDirectory, LPCTSTR szPrefix);
me dan solo 2 errores y una advertencia que son las siguientes:
Código:
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(16) : warning C4518: 'void ' : storage-class or type specifier(s) unexpected here; ignored
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(16) : error C2146: syntax error : missing ';' before identifier 'DataSendAll'
C:\Archivos de programa\Microsoft Visual Studio\MyProjects\Post\Post.cpp(16) : fatal error C1004: unexpected end of file found
Alguien sabe que estoy haciendo mal??
Gracias

Última edición por soymanya; 24/11/2008 a las 09:06