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.

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 08-11-2003, 02:36 AM
Guest
 
Posts: n/a
Default

I googled for your error messages and found a reference to including <my_global.h> before <mysql.h>

http://www.mysql.com/doc/en/Windows_...compiling.html

might be worth a try.
Reply With Quote
  #3  
Old 08-11-2003, 06:23 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Hello and thx for the reply,

I tried to include the <my_global.h> before <mysql.h>.
But I still have the same error.
Reply With Quote
  #4  
Old 08-11-2003, 07:35 AM
Deawin
Fire Beetle
 
Join Date: Jun 2003
Location: Vienna, Austria
Posts: 11
Default

Instead of doing this:
Code:
#include <mysql.h> 
#include <stdio.h> 
#include <string.h>
do this:

Code:
#include <windows.h>
#include <winsock.h>
#include <mysql.h>
#include <stdio.h>
Regards,
Markus
Reply With Quote
  #5  
Old 08-11-2003, 07:55 AM
Guest
 
Posts: n/a
Default

Either including <my_global.h> or Deawin's suggestion get rid of the mysql errors for me.

Quote:
G:\JOB\NightDumps\NightDumps\Source\zone\import_ra w_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_ra w_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'
Browsing the CVS on sourceforge, this would seem to be due to some conditional compilation in eq_packets_struct.h. It is only compiled in if TEST_SERVER_AA is defined.
Reply With Quote
  #6  
Old 08-12-2003, 05:14 AM
Magoth78
Discordant
 
Join Date: Jun 2003
Posts: 345
Default

Hi there and thx for the replys,

yes, I got rid of the mysql errors while compiling and I thank you.

But, I still have the Item_Struct errors.
Derision> I have not exactly understood what you said. You mean I can compile if I #define TEST_SERVER_AA in the eq_packet_structs.h?
Reply With Quote
  #7  
Old 08-12-2003, 06:32 AM
Guest
 
Posts: n/a
Default

Forget what i said about TEST_SERVER_AA, i wasn't paying enough attention to the code. My guess is that the devs have updated the Item_Struct and removed the member unknown144 but not got around to updating the program you are trying to compile.
Reply With Quote
Reply


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 12:21 AM.


 

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