noob_Lance
March 12th, 2006, 10:47 PM
Hey... when i try to compile the following code.. i get the errors below.
heres the code:
#include <stdio.h>
#include <string.h>
FILE *synclient;
int GenFile();
int OpenFile();
int RemoveFile();
int TrimString(char[]);
int GetState();
int ChangeState(int);
int main()
{
GenFile();
}
int GenFile()
{
system ("synclient -l > /tmp/synclient.tmp");
GetState();
}
int OpenFile()
{
if ((synclient = fopen("/tmp/synclient.tmp", "rb")) == NULL)
{
}
}
int GetState()
{
char temp_name[40];
char temp_delim[5];
char temp_setting[20];
int setting;
OpenFile();
while (fscanf(synclient, "%s %s %s", temp_name, temp_delim, temp_setting) == 1)
{
TrimString(temp_name);
TrimString(temp_setting);
if (temp_delim == "Touchpadoff")
{
setting = temp_setting;
ChangeState(setting);
}
}
fclose(synclient);
}
int TrimString(char temp[])
{
strtrim(temp);
return temp;
}
int ChangeState(int setting)
{
if (setting == 0)
{
//turn touchpad off
system("synclient touchpadoff=1");
}
else
{
//turn touchpad on
system("synclient touchpadoff=0");
}
}
and my errors:
lance@testbed:~$ gcc -o tester tester.c
tester.c: In function ‘GetState’:
tester.c:42: warning: assignment makes integer from pointer without a cast
tester.c: In function ‘TrimString’:
tester.c:51: warning: return makes integer from pointer without a cast
/tmp/cc0d0eH5.o: In function `TrimString':
tester.c:(.text+0xf3): undefined reference to `strtrim'
collect2: ld returned 1 exit status
heres the code:
#include <stdio.h>
#include <string.h>
FILE *synclient;
int GenFile();
int OpenFile();
int RemoveFile();
int TrimString(char[]);
int GetState();
int ChangeState(int);
int main()
{
GenFile();
}
int GenFile()
{
system ("synclient -l > /tmp/synclient.tmp");
GetState();
}
int OpenFile()
{
if ((synclient = fopen("/tmp/synclient.tmp", "rb")) == NULL)
{
}
}
int GetState()
{
char temp_name[40];
char temp_delim[5];
char temp_setting[20];
int setting;
OpenFile();
while (fscanf(synclient, "%s %s %s", temp_name, temp_delim, temp_setting) == 1)
{
TrimString(temp_name);
TrimString(temp_setting);
if (temp_delim == "Touchpadoff")
{
setting = temp_setting;
ChangeState(setting);
}
}
fclose(synclient);
}
int TrimString(char temp[])
{
strtrim(temp);
return temp;
}
int ChangeState(int setting)
{
if (setting == 0)
{
//turn touchpad off
system("synclient touchpadoff=1");
}
else
{
//turn touchpad on
system("synclient touchpadoff=0");
}
}
and my errors:
lance@testbed:~$ gcc -o tester tester.c
tester.c: In function ‘GetState’:
tester.c:42: warning: assignment makes integer from pointer without a cast
tester.c: In function ‘TrimString’:
tester.c:51: warning: return makes integer from pointer without a cast
/tmp/cc0d0eH5.o: In function `TrimString':
tester.c:(.text+0xf3): undefined reference to `strtrim'
collect2: ld returned 1 exit status