Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Support > Archive::Windows Servers

Archive::Windows Servers Archive area for Windows Servers's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-10-2003, 11:55 PM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default import_raw_items.cpp compiling errors

Hi there,

I'm trying to get this file compiled but it keeps sending me error that I can't understand.


Here is the file:

Code:
#include <mysql.h>
#include <stdio.h>
#include <string.h>

#include "../common/eq_packet_structs.h"

int main(int argc, char** argv)
{
	MYSQL mysql;
	FILE* fp;
	char db_pass[32];

	if (argc != 5)
	{
		printf("Usage: ./import_raw_items db_address db_username db_name item_filename\n");
		return 1;
	}

	printf("Password:");
	scanf("%s", db_pass);

	mysql_init(&mysql);
	if (!mysql_real_connect(&mysql, argv[1], argv[2], db_pass, argv[3], 0, 0, 0))
	{
		printf("Could not connect to database: Error:%s\n", mysql_error(&mysql));
		return 1;
	}

	fp = fopen(argv[4], "r");
	if (!fp)
	{
		printf("Could not open item file '%s'\n", argv[4]);
		mysql_close(&mysql);
		return 1;
	}

	Item_Struct item;
	Item_Struct item2;
	char query[1024];
	char* end;
	int16 id;
memset(&item, 0, sizeof(item));
memset(&item2, 0, sizeof(item));
//	while(fread(&item, sizeof(item), 1, fp))
	while(fread(&item, 240, 1, fp))
	{
		id = item.item_nr;

		memcpy((char*)&item2, (char*)&item, 144);
		memcpy((char*)&item2.unknown0144[8], (char*)item.unknown0144,  sizeof(item)-152);
//		memcpy((char*)((char*)&item)[148], (char*)((char*)&item)[144], sizeof(item)-148);
/*
		((char*)&item)[144]=0;
		((char*)&item)[145]=0;
		((char*)&item)[146]=0;
		((char*)&item)[147]=0;
*/
		end = query;
		end += sprintf(end, "INSERT INTO items SET id=%i,raw_data=", id);
		*end++ = '\'';
		end += mysql_real_escape_string(&mysql, end, (char*)&item2, sizeof(Item_Struct));
		*end++ = '\'';
		if (mysql_real_query(&mysql, query, (unsigned int) (end-query)))
		{
			printf("Could not insert item %i MySQL said: %s\n", id, mysql_error(&mysql));
		}
	}
}
and here are the errors:

Code:
--------------------Configuration: Zone - Win32 GuildWars Debug--------------------
Compiling...
import_raw_items.cpp
g:\lib\mysql_com.h(116) : error C2146: syntax error : missing ';' before identifier 'fd'
g:\lib\mysql_com.h(116) : error C2501: 'SOCKET' : missing storage-class or type specifiers
g:\lib\mysql_com.h(116) : error C2501: 'fd' : missing storage-class or type specifiers
g:\lib\mysql_com.h(180) : error C2065: 'SOCKET' : undeclared identifier
g:\lib\mysql_com.h(180) : error C2146: syntax error : missing ')' before identifier 's'
g:\lib\mysql_com.h(181) : error C2059: syntax error : ')'
G:\JOB\NightDumps\NightDumps\Source\zone\import_raw_items.cpp(50) : error C2039: 'unknown0144' : is not a member of 'Item_Struct'
        G:\JOB\NightDumps\NightDumps\Source\zone\../common/eq_packet_structs.h(973) : see declaration of 'Item_Struct'
G:\JOB\NightDumps\NightDumps\Source\zone\import_raw_items.cpp(50) : error C2039: 'unknown0144' : is not a member of 'Item_Struct'
        G:\JOB\NightDumps\NightDumps\Source\zone\../common/eq_packet_structs.h(973) : see declaration of 'Item_Struct'
Error executing cl.exe.

import_raw_items.obj - 8 error(s), 0 warning(s)
Any idea please?
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:48 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3