Compiler Problems

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Compiler Problems

Post by Mckorr » Fri Mar 07, 2003 6:22 pm

Brain not working... keep getting these errors when trying to compile EQlib.dll:

Code: Select all

Compiling resources...
Compiling...
EQLib.cpp
events.cpp
C:\IRC-20030111\EQLib\mq.h(778) : error C2065: 'INTERFACE' : undeclared identifier
C:\IRC-20030111\EQLib\mq.h(778) : error C2065: 'This' : undeclared identifier
C:\IRC-20030111\EQLib\mq.h(778) : error C2275: 'PCHAR' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\winnt.h(161) : see declaration of 'PCHAR'
C:\IRC-20030111\EQLib\mq.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\mq.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\mq.h(778) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\mq.h(778) : error C2071: 'fEQWriteChatColor' : illegal storage class
C:\IRC-20030111\EQLib\mq.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\mq.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\mq.h(781) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\mq.h(781) : error C2071: 'fEQClick' : illegal storage class
C:\IRC-20030111\EQLib\mq.h(782) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\mq.h(782) : error C2275: 'LPVOID' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(158) : see declaration of 'LPVOID'
C:\IRC-20030111\EQLib\mq.h(782) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\mq.h(782) : error C2071: 'fGetDeviceState' : illegal storage class
PerlMod.cpp
C:\IRC-20030111\EQLib\MQ.h(778) : error C2065: 'INTERFACE' : undeclared identifier
C:\IRC-20030111\EQLib\MQ.h(778) : error C2065: 'This' : undeclared identifier
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'PCHAR' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\winnt.h(161) : see declaration of 'PCHAR'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(778) : error C2071: 'fEQWriteChatColor' : illegal storage class
C:\IRC-20030111\EQLib\MQ.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(781) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(781) : error C2071: 'fEQClick' : illegal storage class
C:\IRC-20030111\EQLib\MQ.h(782) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(782) : error C2275: 'LPVOID' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(158) : see declaration of 'LPVOID'
C:\IRC-20030111\EQLib\MQ.h(782) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(782) : error C2071: 'fGetDeviceState' : illegal storage class
PerlModCore.cpp
C:\IRC-20030111\EQLib\MQ.h(778) : error C2065: 'INTERFACE' : undeclared identifier
C:\IRC-20030111\EQLib\MQ.h(778) : error C2065: 'This' : undeclared identifier
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'PCHAR' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\winnt.h(161) : see declaration of 'PCHAR'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(778) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(778) : error C2071: 'fEQWriteChatColor' : illegal storage class
C:\IRC-20030111\EQLib\MQ.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(781) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(781) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(781) : error C2071: 'fEQClick' : illegal storage class
C:\IRC-20030111\EQLib\MQ.h(782) : error C2275: 'DWORD' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(141) : see declaration of 'DWORD'
C:\IRC-20030111\EQLib\MQ.h(782) : error C2275: 'LPVOID' : illegal use of this type as an expression
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\windef.h(158) : see declaration of 'LPVOID'
C:\IRC-20030111\EQLib\MQ.h(782) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\IRC-20030111\EQLib\MQ.h(782) : error C2071: 'fGetDeviceState' : illegal storage class
stdafx.cpp
timers.cpp
Error executing cl.exe.
Creating browse info file...

EQLib.dll - 45 error(s), 0 warning(s)
Any help?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri Mar 07, 2003 6:25 pm

More information. Problem seems to be in this section of mq.h:

Code: Select all

// ***************************************************************************
// Everquest function typedefs
// ***************************************************************************
typedef DWORD	(__stdcall *fEQWriteChatColor)(THIS_ PCHAR, DWORD, DWORD);
typedef PCHAR	(__stdcall *fEQGetStringByID)(DWORD);
typedef VOID	(__cdecl *fEQCommand)(PSPAWNINFO, PCHAR);
typedef VOID	(__stdcall *fEQClick)(THIS_ DWORD, DWORD);
typedef HRESULT	(__stdcall *fGetDeviceState)(THIS_ DWORD, LPVOID);
typedef DWORD	(__stdcall *fEQScreenItem)(DWORD, DWORD, DWORD);
typedef DWORD	(__stdcall *fEQScreenSpawn)(DWORD, DWORD);
typedef PCHAR   (__stdcall *fEQNewUIINI)(VOID);

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Mar 07, 2003 7:11 pm

You are picking up the wrong dinput.h for one thing.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Mar 07, 2003 8:03 pm

For the VC60 compiler, you must:
1. Compile the detours source and move lib and pdb file into appropriate directory
2. Create a blank win32 application project pointing at the MQ directory.
3. Add a win32 dll project to the project in step 2. Call it eqlib
4. Add all the sources in the eqlib directory to the eqlib project.
5. Add the CINTERFACE definition to the Preprocess definitions.
6. Add the DX8.1 include path to the Additional include directories.
7. Add ws2_32.lib to the Object/library modules.
8. Add ..\Detours\lib (where you put the objects from 1.) to Additional library path
9. Press F7 and cross your fingers.
10. Switch back to the main project.
11. Add the sources in the MacroQuest directory to this project.
12. Press F7 and pray.

Everything should have compiled at that point. Gather up exe and eqlib.dll and you should be good to go.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Mar 10, 2003 9:02 am

Thanks, that worked. Problem was adding CINTERFACE to preprocess, and in recompiling Detours.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Mar 10, 2003 10:41 am

sorry you got a coding newb here, howcomile the detours source?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Mar 10, 2003 11:03 am

Again, depends on what compiler you are using.

Extract Detours.exe to a temp directory. That will create an SRC directory within the temp directory.

Now, open up a command console, go to that directory. In my case C:\temp\src. If you are using VC++, from the command line type "nmake". That will read the Makefile in the SRC directory and create three files, detours.h, detours.lib, and detours.pdb. Copy detours.h to the include subdirectory of your compiler. Copy the other two to the lib directory.

These files will now be ready to use for compiling, and your compiler will find them without jumping through a bunch of hoops.

Now, when you extract Detours.exe you will find that these three files already exist. Problem is they won't work for compiling MQ. Delete the files that came with the distribution and recompile as above.

papiraul
a lesser mummy
a lesser mummy
Posts: 76
Joined: Fri Sep 27, 2002 8:46 am

Post by papiraul » Mon Mar 10, 2003 12:12 pm

How do I extract detours.exe form detours.h in VC6?

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Mar 10, 2003 1:21 pm

I didnt see any detours.exe file, wheres it at?

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Mar 10, 2003 1:23 pm

of yea I am using vc++

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Mar 10, 2003 1:29 pm

Ack!

Detours is distributed by Microsoft. You can get it here: http://research.microsoft.com/sn/detours/

Download detours.exe, that is a self-extracting WinZip file. Run it (double click on it) and pick a temp directory to extract it to, say C:\temp.

Now, go to C:\temp, and delete the files in the LIB and INCLUDE subdirectory. Call up a command console (a command line, y'know, C:>).

Change to the SRC directory (C:\temp\src). Execute a make command, that's "nmake" if you have VC++. This will compile the source code in the SRC directory, and place detours.h in the empty INCLUDE directory, and detours.lib and detours.pdb in the LIB directory. Copy those files to your compilers LIB and INCLUDE directories.

The detours part of the code will now compile correctly.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Mar 10, 2003 1:41 pm

woot, thanks

almostleet
orc pawn
orc pawn
Posts: 11
Joined: Mon Mar 10, 2003 2:20 pm

Post by almostleet » Mon Mar 10, 2003 2:23 pm

I have eqlib.dll and the .exe compiled but MQ shuts down as soon as I run it. Any ideas on what I did wrong?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Mar 10, 2003 2:45 pm

Which version of the sourcecode are you using?

Do you have the latest offsets, and are they in the eqgame.ini file?

Sounds like a basic configuration problem.

papiraul
a lesser mummy
a lesser mummy
Posts: 76
Joined: Fri Sep 27, 2002 8:46 am

Post by papiraul » Mon Mar 10, 2003 2:49 pm

Mkorr.. could you please explain a bit more in detail on how to add preprocess and Dx8.1 and so on?