I'm getting some errors that I can't find the source of, and I haven't even done anything in my code yet except some includes.
Before I get started, this is for a project for a class - I'm modifying this library: http://code.google.com/p/wiimote-api/ but before I can do anything, I need to be able to test the library. The program I'm trying to write is just a wrapper to connect to the Wiimote and test the library.
I am using Windows Vista Home Premium, and Dev-C++ version 4.9.9.2
In file included from wiimote-tester.c:1:
wiimote-tester.h:1: error: syntax error at '#' token
wiimote-tester.h:1: error: syntax error before '<' token
wiimote-tester.h:2: error: syntax error at '#' token
wiimote-tester.h:3: error: syntax error at '#' token
In file included from wiimote-tester.c:1:
wiimote-tester.h:4:3: invalid preprocessing directive #incldue
wiimote-tester.h:5: error: syntax error at '#' token
wiimote-tester.h:5: error: stray '\' in program
wiimote-tester.h:6: error: syntax error at '#' token
wiimote-tester.h:6: error: stray '\' in program
wiimote-tester.c:8: error: syntax error before string constant
wiimote-tester.c:8: warning: data definition has no type or storage class
mingw32-make: *** [wiimote-tester.o] Error 1
Execution terminated
The odd thing is that I tried commenting out the first include. using / #include "wiimote-tester.h" / the program compiles and pops up with the "Done!" message just fine. But if I use:
// #include "wiimote-tester.h"
Then dev-cpp shows shades the line as commented out, but I get different errors:
wiimote-tester.c:1: error: syntax error before '/' token
wiimote-tester.c:1: error: syntax error at '#' token
wiimote-tester.c:8: error: syntax error before string constant
wiimote-tester.c:8: warning: data definition has no type or storage class
mingw32-make: *** [wiimote-tester.o] Error 1
Execution terminated
I got similar errors when I successfully comment out or remove the include, and use '//' to comment out another line.
That's all the information I can think to include on my problem. I tired searching for similar problems, and someone suggested that the "syntax error at '#'" error in an included file means there was an error before the include statement... except that there's nothing there except include. This is, of course, in addition to reading the READ THIS... topic.
Can someone help me figure why I'm not compiling so I can get to the actual project?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Everything between two "--------" is copied and pasted. I was just confusing the names, as wiimote-api is the project I'll be modifying. All these problems, however, are in compiling wiimote-tester.c and wiimote-tester.h
At any rate, I found the project option for -ansi, which was by default on when I started the project, and turned it off, which fixed my commenting error. More importantly, I turned off the option below it, which added the -traditional parameter, and that fixed my other syntax problems. Thanks for the help, cpns.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good. I was going to suggest removing -traditional-cpp as it is seldom needed and often causes problems. If these options appeared in your project you must have set them under Tools|Compiler options. These settings are inherited when a new project is created.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2008-04-18
Try to change the content of wiimote-api.h for this one:
include <stdio.h>
include <stdlib.h>
include <windows.h>
incldue "full-path\ddk\wdm.h"
include "full-path\ddk\hidsdi.h"
include "full-path\ddk\setupapi.h"
Of course, full-path is the path to atgat ddk dir in your system
And see what happen.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2008-04-18
opps. the strange word "atgat" is really "that"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You say you posted the content of wiimote-api.c but the log shows that you compiled wiimote-tester.c. Are you compiling what you think you are compiling? Clarify.
I have no idea what Old Newbie is thinking, the evidence does not seem to support his suggestion, there is no issue of not finding the files here.
Line 4 of wiimote-api.h has "include" spelled incorrectly. If this is your typo, then copy & paste the content for goodness sake, don't re-type it!
With respect to "wiimote-tester.c:1: error: syntax error before '/' token ", the code you posted does not have a '/' on line 1.
None of the error messages for wiimote-tester.c appear to correspond to anything you have posted. I think that you are simply not compiling the file that you think you are.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm getting some errors that I can't find the source of, and I haven't even done anything in my code yet except some includes.
Before I get started, this is for a project for a class - I'm modifying this library: http://code.google.com/p/wiimote-api/ but before I can do anything, I need to be able to test the library. The program I'm trying to write is just a wrapper to connect to the Wiimote and test the library.
I am using Windows Vista Home Premium, and Dev-C++ version 4.9.9.2
This is the current contents of wiimote-api.c:
include "wiimote-tester.h"
int main(int argc, char *argv[])
{
}
This is the current contents of wiimote-api.h:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#incldue <ddk\wdm.h>
#include <ddk\hidsdi.h>
#include <ddk\setupapi.h>
And finally the compile log:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
mingw32-make -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c wiimote-tester.c -o wiimote-tester.o -I"C:/WINDDK/3790.1830/inc" -I"C:/MinGW/include" -ansi -traditional-cpp
In file included from wiimote-tester.c:1:
wiimote-tester.h:1: error: syntax error at '#' token
wiimote-tester.h:1: error: syntax error before '<' token
wiimote-tester.h:2: error: syntax error at '#' token
wiimote-tester.h:3: error: syntax error at '#' token
In file included from wiimote-tester.c:1:
wiimote-tester.h:4:3: invalid preprocessing directive #incldue
wiimote-tester.h:5: error: syntax error at '#' token
wiimote-tester.h:5: error: stray '\' in program
wiimote-tester.h:6: error: syntax error at '#' token
wiimote-tester.h:6: error: stray '\' in program
wiimote-tester.c:8: error: syntax error before string constant
wiimote-tester.c:8: warning: data definition has no type or storage class
mingw32-make: *** [wiimote-tester.o] Error 1
Execution terminated
The odd thing is that I tried commenting out the first include. using / #include "wiimote-tester.h" / the program compiles and pops up with the "Done!" message just fine. But if I use:
// #include "wiimote-tester.h"
Then dev-cpp shows shades the line as commented out, but I get different errors:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
mingw32-make -f "C:\Dev-Cpp\Makefile.win" all
gcc.exe -c wiimote-tester.c -o wiimote-tester.o -I"C:/WINDDK/3790.1830/inc" -I"C:/MinGW/include" -ansi -traditional-cpp
wiimote-tester.c:1: error: syntax error before '/' token
wiimote-tester.c:1: error: syntax error at '#' token
wiimote-tester.c:8: error: syntax error before string constant
wiimote-tester.c:8: warning: data definition has no type or storage class
mingw32-make: *** [wiimote-tester.o] Error 1
Execution terminated
I got similar errors when I successfully comment out or remove the include, and use '//' to comment out another line.
That's all the information I can think to include on my problem. I tired searching for similar problems, and someone suggested that the "syntax error at '#'" error in an included file means there was an error before the include statement... except that there's nothing there except include. This is, of course, in addition to reading the READ THIS... topic.
Can someone help me figure why I'm not compiling so I can get to the actual project?
Everything between two "--------" is copied and pasted. I was just confusing the names, as wiimote-api is the project I'll be modifying. All these problems, however, are in compiling wiimote-tester.c and wiimote-tester.h
At any rate, I found the project option for -ansi, which was by default on when I started the project, and turned it off, which fixed my commenting error. More importantly, I turned off the option below it, which added the -traditional parameter, and that fixed my other syntax problems. Thanks for the help, cpns.
Good. I was going to suggest removing -traditional-cpp as it is seldom needed and often causes problems. If these options appeared in your project you must have set them under Tools|Compiler options. These settings are inherited when a new project is created.
Clifford
Try to change the content of wiimote-api.h for this one:
include <stdio.h>
include <stdlib.h>
include <windows.h>
incldue "full-path\ddk\wdm.h"
include "full-path\ddk\hidsdi.h"
include "full-path\ddk\setupapi.h"
Of course, full-path is the path to atgat ddk dir in your system
And see what happen.
opps. the strange word "atgat" is really "that"
That didn't fix the errors, nor did commenting out the ddk include statements (I also just noticed that the first said "incldue" and corrected it).
I'm worried I have some problem in the way I set up the compiler, since using two slashes to comment anything out also produces a syntax error.
I use the instructions here to get it working with Vista: http://sourceforge.net/forum/forum.php?thread_id=1715032&forum_id=48211
You say you posted the content of wiimote-api.c but the log shows that you compiled wiimote-tester.c. Are you compiling what you think you are compiling? Clarify.
I have no idea what Old Newbie is thinking, the evidence does not seem to support his suggestion, there is no issue of not finding the files here.
Line 4 of wiimote-api.h has "include" spelled incorrectly. If this is your typo, then copy & paste the content for goodness sake, don't re-type it!
With respect to "wiimote-tester.c:1: error: syntax error before '/' token ", the code you posted does not have a '/' on line 1.
None of the error messages for wiimote-tester.c appear to correspond to anything you have posted. I think that you are simply not compiling the file that you think you are.
Clifford
oops! I was reading your second log and the posted code. The -ansi option forces C89 compliance, the // comment delimiter is not valid in C89.
You have probably confused the issue by adding that part to your problem.