Compiler errors

A

Andy

This are the errors I am getting from this source.
Can someone help me with this ?

Thanks,
Andy

// Disabler.cpp : Defines the entry point for the console application.
//

#include <stdio.h>

// All programs using the Synaptics COM SDK include SynKit.h
#include "SynKit.h"

enum eAction {eNone = -1,
eDisableStick = 0x000,
eEnableStick = 0x001,
eDisableTouchPad = 0x100,
eEnableTouchPad = 0x101,
eDisableStickButtons = 0x010,
eEnableStickButtons = 0x011,
eDisableTouchPadButtons = 0x110,
eEnableTouchPadButtons = 0x111,
eDisablePressToSelect = 0x020,
eEnablePressToSelect = 0x021,
eDisableTaps = 0x120,
eEnableTaps = 0x121,
eWaitForStickButton = 0x030,
eWaitForTouchPadButton = 0x130
};

enum eAction ParseCommandLine(int argc, char* argv[])
{
if (argc != 2)
return eNone;
else if(!stricmp(argv[1], "DisableStick"))
return eDisableStick;
else if(!stricmp(argv[1], "EnableStick"))
return eEnableStick;
else if(!stricmp(argv[1], "DisableTouchPad"))
return eDisableTouchPad;
else if(!stricmp(argv[1], "EnableTouchPad"))
return eEnableTouchPad;
else if(!stricmp(argv[1], "DisableStickButtons"))
return eDisableStickButtons;
else if(!stricmp(argv[1], "EnableStickButtons"))
return eEnableStickButtons;
else if(!stricmp(argv[1], "DisableTouchPadButtons"))
return eDisableTouchPadButtons;
else if(!stricmp(argv[1], "EnableTouchPadButtons"))
return eEnableTouchPadButtons;
else if(!stricmp(argv[1], "DisablePressToSelect"))
return eDisablePressToSelect;
else if(!stricmp(argv[1], "EnablePressToSelect"))
return eEnablePressToSelect;
else if(!stricmp(argv[1], "DisableTaps"))
return eDisableTaps;
else if(!stricmp(argv[1], "EnableTaps"))
return eEnableTaps;
else if(!stricmp(argv[1], "WaitForStickButton"))
return eWaitForStickButton;
else if(!stricmp(argv[1], "WaitForTouchPadButton"))
return eWaitForTouchPadButton;
else
return eNone;
};

int main(int argc, char* argv[])
{
ISynAPI *pAPI = 0;

if (CoInitialize(0) ||
CoCreateInstance(_uuidof(SynAPI), 0,
CLSCTX_INPROC_SERVER, _uuidof(ISynAPI), (void **) &pAPI) ||
pAPI->Initialize())
{
printf("Could not obtain a Synaptics API object.\n");
exit(-1);
}

int iAction = ParseCommandLine(argc, argv);
if (iAction == eNone)
{
printf("Failed to parse a command.\n");
exit(-1);
}

ISynDevice *pDevice = 0;
if (iAction & 0x100)
{
long lHandle = -1;
if (pAPI->FindDevice(SE_ConnectionAny, SE_DeviceTouchPad, &lHandle) ||
pAPI->CreateDevice(lHandle, &pDevice))
{
printf("Unable to find a Synaptics TouchPad.\n");
exit(-1);
}
}
else
{
long lHandle = -1;
if (pAPI->FindDevice(SE_ConnectionAny, SE_DeviceIBMCompatibleStick, &lHandle) ||
pAPI->CreateDevice(lHandle, &pDevice))
{
printf("Unable to find an IBM compatible stick.\n");
exit(-1);
}
}

switch (iAction)
{
case eDisableStick:
case eDisableTouchPad:
pDevice->SetProperty(SP_DisableState, 1);
break;
case eEnableStick:
case eEnableTouchPad:
pDevice->SetProperty(SP_DisableState, 0);
break;
case eDisableStickButtons:
case eDisableTouchPadButtons:
{
long lMask;
pDevice->GetProperty(SP_LeftButtonAction, &lMask);
lMask &= ~SF_ActionPrimary;
pDevice->SetProperty(SP_LeftButtonAction, lMask);

pDevice->GetProperty(SP_RightButtonAction, &lMask);
lMask &= ~SF_ActionSecondary;
pDevice->SetProperty(SP_LeftButtonAction, lMask);
}
break;
case eEnableStickButtons:
case eEnableTouchPadButtons:
{
long lMask;
pDevice->GetProperty(SP_LeftButtonAction, &lMask);
lMask |= SF_ActionPrimary;
pDevice->SetProperty(SP_LeftButtonAction, lMask);

pDevice->GetProperty(SP_RightButtonAction, &lMask);
lMask |= SF_ActionSecondary;
pDevice->SetProperty(SP_LeftButtonAction, lMask);
}
break;
case eDisablePressToSelect:
case eDisableTaps:
{
long lMask;
pDevice->GetProperty(SP_Gestures, &lMask);
lMask &= ~SF_GestureTap;
pDevice->SetProperty(SP_Gestures, lMask);
}
break;
case eEnablePressToSelect:
case eEnableTaps:
{
long lMask;
pDevice->GetProperty(SP_Gestures, &lMask);
lMask |= SF_GestureTap;
pDevice->SetProperty(SP_Gestures, lMask);
}
break;
case eWaitForStickButton:
case eWaitForTouchPadButton:
{
HANDLE hEvent = CreateEvent(0, 0, 0, 0);
pDevice->SetEventNotification(hEvent);

for ( ; ; )
{
WaitForSingleObject(hEvent, INFINITE);

SynPacket Packet;
pDevice->LoadPacket(Packet);

if (Packet.ButtonState())
{
exit(0);
}
}
}
break;
default:
break;
};

return 0;
}

c:\devc++\dev-cpp\mingw32\include\comutil.h In file included from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/comutil.h
c:\devc++\dev-cpp\mingw32\include\comdef.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/comdef.h
c:\devc++\dev-cpp\mingw32\include\SynWraps.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynWraps.h
c:\devc++\dev-cpp\mingw32\include\SynKit.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynKit.h
C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp from C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "i64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "i64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant
c:\devc++\dev-cpp\mingw32\include\SynKit.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynKit.h
C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp from C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp
c:\devc++\dev-cpp\mingw32\include\comdef.h comip.h: No such file or directory.
 
I

Ian Collins

This are the errors I am getting from this source.
Can someone help me with this ?

Thanks,

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

Without looking at the code, it looks like your build environment is
misconfigured.
 
1

1 2

This are the errors I am getting from this source.
Can someone help me with this ?

The sample is writen for Visual C++, but you are compiling it with Dev-
C++ (specifically MinGW, the compiler that Dev-C++ uses). For example,
i64 and ui64 are integer constant suffix extensions of VC++, and
comdef.h is part of VC++ compiler COM support.
 
A

Andy

The sample is writen for Visual C++, but you are compiling it with Dev-

C++ (specifically MinGW, the compiler that Dev-C++ uses). For example,

i64 and ui64 are integer constant suffix extensions of VC++, and

comdef.h is part of VC++ compiler COM support.

Thanks.
Does Visual C++ express edition make working .exes?
 
A

Andy

Am 11/19/12 3:39 PM, schrieb Andy:





Yes, it does. Note that the compiler in the Express Edition is the same

as the ones in any other edition (Professional, Team, ...). The major

difference between Express and the other editions is that Express misses

a lot of libraries like MFC, ATL, and so on. In your case, this might

not be a problem because you only use COM objects. If you wanted to

write COM objects, you should use the ATL library which is part of the

Professional Edition.



Regards,

Stuart

I loaded my source but see no compile option or make all option.

This make take a while. :)

Andy
 
G

Geoff

I loaded my source but see no compile option or make all option.

This make take a while. :)

You can't just load a source file into VC and compile. You need to
create a project of the proper type (if .sln or .dsp or .dsw files
don't exist) and then add your source files to that project via the
IDE.

If these files exist in the folder with your source then simply open
one of them with the Open Project dialog in the VC IDE.
 
A

Andy

On Mon, 19 Nov 2012 07:50:30 -0800 (PST), Andy




You can't just load a source file into VC and compile. You need to

create a project of the proper type (if .sln or .dsp or .dsw files

don't exist) and then add your source files to that project via the

IDE.



If these files exist in the folder with your source then simply open

one of them with the Open Project dialog in the VC IDE.

I have done everything you said.

When I choose a directory that HAS disabler.cpp, it can't see it.

I even changed my dir name from C++ to C:\source to see if VC has directory issues.

Andy
 
R

red floyd

When I choose a directory that HAS disabler.cpp, it can't see it.

I even changed my dir name from C++ to C:\source to see if VC has directory issues.

At this point, you are out of the realm of the C++ language proper,
and into "How do I use my compiler/IDE?" I'd suggest asking in a
forum dedicated to VS.
 
S

Stuart

When I choose a directory that HAS disabler.cpp, it can't see it. I
even changed my dir name from C++ to C:\source to see if VC has
directory issues.

Umm, you cannot tell VC to compile all the .cpp files of a directory.
Instead you have to add each and every file of the directory to your
project. Of course, you can add a lot of files in one go, so there is
hardly any additional overhead.

Regards,
Stuart
 
1

1 2

I have done everything you said.

When I choose a directory that HAS disabler.cpp, it can't see it.

I even changed my dir name from C++ to C:\source to see if VC has directory issues.

Do these steps:

1. Create a new project by clicking the "New Project" button in the
toolbar at the top of Visual C++ (or in the File menu), select "Empty
Project", type the name the project, and click OK.

2. In the Solution Explorer panel, right-click the project name (not
the solution) and select Add -> New Item, then select "C++ File", type
the name of the file, and click Add. Then copy and paste the code into
the file and save it. You should see the file under the "Source Files"
item in Solution Explorer.

3. Click the Debug menu and select "Build Solution". You should now
have an EXE in the Debug or Release directories within the solution's
directory.

4. In order for the program to run successfully, the COM DLL of the
API you're using needs to be registered. Download the DLL if you
haven't already, then click the Tools menu of Visual C++ and select
"Visual Studio Command Prompt", and then type "regsvr32 <DLL
name>" (replace <DLL name> with the filename of the actual DLL).
 
A

Andy

This are the errors I am getting from this source.

Can someone help me with this ?



Thanks,

Andy



// Disabler.cpp : Defines the entry point for the console application.

//



#include <stdio.h>



// All programs using the Synaptics COM SDK include SynKit.h

#include "SynKit.h"



enum eAction {eNone = -1,

eDisableStick = 0x000,

eEnableStick = 0x001,

eDisableTouchPad = 0x100,

eEnableTouchPad = 0x101,

eDisableStickButtons = 0x010,

eEnableStickButtons = 0x011,

eDisableTouchPadButtons = 0x110,

eEnableTouchPadButtons = 0x111,

eDisablePressToSelect = 0x020,

eEnablePressToSelect = 0x021,

eDisableTaps = 0x120,

eEnableTaps = 0x121,

eWaitForStickButton = 0x030,

eWaitForTouchPadButton = 0x130

};



enum eAction ParseCommandLine(int argc, char* argv[])

{

if (argc != 2)

return eNone;

else if(!stricmp(argv[1], "DisableStick"))

return eDisableStick;

else if(!stricmp(argv[1], "EnableStick"))

return eEnableStick;

else if(!stricmp(argv[1], "DisableTouchPad"))

return eDisableTouchPad;

else if(!stricmp(argv[1], "EnableTouchPad"))

return eEnableTouchPad;

else if(!stricmp(argv[1], "DisableStickButtons"))

return eDisableStickButtons;

else if(!stricmp(argv[1], "EnableStickButtons"))

return eEnableStickButtons;

else if(!stricmp(argv[1], "DisableTouchPadButtons"))

return eDisableTouchPadButtons;

else if(!stricmp(argv[1], "EnableTouchPadButtons"))

return eEnableTouchPadButtons;

else if(!stricmp(argv[1], "DisablePressToSelect"))

return eDisablePressToSelect;

else if(!stricmp(argv[1], "EnablePressToSelect"))

return eEnablePressToSelect;

else if(!stricmp(argv[1], "DisableTaps"))

return eDisableTaps;

else if(!stricmp(argv[1], "EnableTaps"))

return eEnableTaps;

else if(!stricmp(argv[1], "WaitForStickButton"))

return eWaitForStickButton;

else if(!stricmp(argv[1], "WaitForTouchPadButton"))

return eWaitForTouchPadButton;

else

return eNone;

};



int main(int argc, char* argv[])

{

ISynAPI *pAPI = 0;



if (CoInitialize(0) ||

CoCreateInstance(_uuidof(SynAPI), 0,

CLSCTX_INPROC_SERVER, _uuidof(ISynAPI), (void **) &pAPI) ||

pAPI->Initialize())

{

printf("Could not obtain a Synaptics API object.\n");

exit(-1);

}



int iAction = ParseCommandLine(argc, argv);

if (iAction == eNone)

{

printf("Failed to parse a command.\n");

exit(-1);

}



ISynDevice *pDevice = 0;

if (iAction & 0x100)

{

long lHandle = -1;

if (pAPI->FindDevice(SE_ConnectionAny, SE_DeviceTouchPad, &lHandle) ||

pAPI->CreateDevice(lHandle, &pDevice))

{

printf("Unable to find a Synaptics TouchPad.\n");

exit(-1);

}

}

else

{

long lHandle = -1;

if (pAPI->FindDevice(SE_ConnectionAny, SE_DeviceIBMCompatibleStick, &lHandle) ||

pAPI->CreateDevice(lHandle, &pDevice))

{

printf("Unable to find an IBM compatible stick.\n");

exit(-1);

}

}



switch (iAction)

{

case eDisableStick:

case eDisableTouchPad:

pDevice->SetProperty(SP_DisableState, 1);

break;

case eEnableStick:

case eEnableTouchPad:

pDevice->SetProperty(SP_DisableState, 0);

break;

case eDisableStickButtons:

case eDisableTouchPadButtons:

{

long lMask;

pDevice->GetProperty(SP_LeftButtonAction, &lMask);

lMask &= ~SF_ActionPrimary;

pDevice->SetProperty(SP_LeftButtonAction, lMask);



pDevice->GetProperty(SP_RightButtonAction, &lMask);

lMask &= ~SF_ActionSecondary;

pDevice->SetProperty(SP_LeftButtonAction, lMask);

}

break;

case eEnableStickButtons:

case eEnableTouchPadButtons:

{

long lMask;

pDevice->GetProperty(SP_LeftButtonAction, &lMask);

lMask |= SF_ActionPrimary;

pDevice->SetProperty(SP_LeftButtonAction, lMask);



pDevice->GetProperty(SP_RightButtonAction, &lMask);

lMask |= SF_ActionSecondary;

pDevice->SetProperty(SP_LeftButtonAction, lMask);

}

break;

case eDisablePressToSelect:

case eDisableTaps:

{

long lMask;

pDevice->GetProperty(SP_Gestures, &lMask);

lMask &= ~SF_GestureTap;

pDevice->SetProperty(SP_Gestures, lMask);

}

break;

case eEnablePressToSelect:

case eEnableTaps:

{

long lMask;

pDevice->GetProperty(SP_Gestures, &lMask);

lMask |= SF_GestureTap;

pDevice->SetProperty(SP_Gestures, lMask);

}

break;

case eWaitForStickButton:

case eWaitForTouchPadButton:

{

HANDLE hEvent = CreateEvent(0, 0, 0, 0);

pDevice->SetEventNotification(hEvent);



for ( ; ; )

{

WaitForSingleObject(hEvent, INFINITE);



SynPacket Packet;

pDevice->LoadPacket(Packet);



if (Packet.ButtonState())

{

exit(0);

}

}

}

break;

default:

break;

};



return 0;

}



c:\devc++\dev-cpp\mingw32\include\comutil.h In file included from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/comutil.h

c:\devc++\dev-cpp\mingw32\include\comdef.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/comdef.h

c:\devc++\dev-cpp\mingw32\include\SynWraps.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynWraps.h

c:\devc++\dev-cpp\mingw32\include\SynKit.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynKit.h

C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp from C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "i64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "i64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\intsafe.h [Error] invalid suffix "ui64" on integer constant

c:\devc++\dev-cpp\mingw32\include\SynKit.h from c:\devc++\dev-cpp\mingw32\bin\../lib/gcc/mingw32/4.7.0/../../../../include/SynKit.h

C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp from C:\DevC++\Dev-Cpp\Examples\Disabler\Disabler.cpp

c:\devc++\dev-cpp\mingw32\include\comdef.h comip.h: No such file or directory.

It compiled ok, but got an error on linking.

1>LINK : fatal error LNK1561: entry point must be defined
 
I

Ian Collins

On 11/20/12 14:12, Andy wrote:

Did you have to quote all that plus the extra google bank lines just to
ask this?
It compiled ok, but got an error on linking.

1>LINK : fatal error LNK1561: entry point must be defined

I was suggested elsewhere that you ask on a VS forum, that was good advice!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top