473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Unexplained syntax error in variable definition

3
I'm trying to compile big piece of software which is X11 server on CentOS 7. During "make" I see this message:
<file>:34 syntax error near:
typedef unsigned short int __u_short;
Line 34 is exactly as message quotes. I'm not much C programmer but this line looks good to me. Here are couple more lines not marked as errors:
typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;
What is wrong with this code?
Apr 11 '15 #1
5 1667
weaknessforcats
9,208 Expert Mod 8TB
There is no problem with the code you posted. All the error on line 34 means is that when the compiler got to line 34 there is an error. The error is on line 34 or 33 or 32 clear up to the beginning of the code.

Start commenting out lines of code until it compiles. Then gradually remove the comments until the code fails to compile. There will be your actual error.
Apr 12 '15 #2
MikeZZ
3
The problem is that the code is dynamically build by "make". The four lines I quote are first the first four lines after initial comments. I still don't see any problems with them.
Apr 12 '15 #3
weaknessforcats
9,208 Expert Mod 8TB
Are you talking about the preprocessor generating code? Like there are macros at the beginning of the code? The "make" utility does not generate code.

Maybe you could post the beginning of the file that has the problem.
Apr 12 '15 #4
MikeZZ
3
The file is in /tmp directory, its name starts with tmp and then 6 random characters and qualifier .d, it also has blank lines
Expand|Select|Wrap|Line Numbers
  1. # 1 "./Xserver.d"
  2. # 1 "<built-in>"
  3. # 1 "<command-line>"
  4. # 1 "/usr/include/stdc-predef.h" 1 3 4
  5. # 1 "<command-line>" 2
  6. # 1 "./Xserver.d"
  7. # 31 "./Xserver.d"
  8. # 1 "/usr/include/sys/types.h" 1 3 4
  9. # 25 "/usr/include/sys/types.h" 3 4
  10. # 1 "/usr/include/features.h" 1 3 4
  11. # 375 "/usr/include/features.h" 3 4
  12. # 1 "/usr/include/sys/cdefs.h" 1 3 4
  13. # 392 "/usr/include/sys/cdefs.h" 3 4
  14. # 1 "/usr/include/bits/wordsize.h" 1 3 4
  15. # 393 "/usr/include/sys/cdefs.h" 2 3 4
  16. # 376 "/usr/include/features.h" 2 3 4
  17. # 399 "/usr/include/features.h" 3 4
  18. # 1 "/usr/include/gnu/stubs.h" 1 3 4
  19. # 10 "/usr/include/gnu/stubs.h" 3 4
  20. # 1 "/usr/include/gnu/stubs-64.h" 1 3 4
  21. # 11 "/usr/include/gnu/stubs.h" 2 3 4
  22. # 400 "/usr/include/features.h" 2 3 4
  23. # 26 "/usr/include/sys/types.h" 2 3 4
  24.  
  25.  
  26.  
  27. # 1 "/usr/include/bits/types.h" 1 3 4
  28. # 27 "/usr/include/bits/types.h" 3 4
  29. # 1 "/usr/include/bits/wordsize.h" 1 3 4
  30. # 28 "/usr/include/bits/types.h" 2 3 4
  31.  
  32.  
  33. typedef unsigned char __u_char;
  34. typedef unsigned short int __u_short;
  35. typedef unsigned int __u_int;
  36. typedef unsigned long int __u_long;
  37.  
  38.  
  39. typedef signed char __int8_t
Apr 12 '15 #5
weaknessforcats
9,208 Expert Mod 8TB
This code compiles fine:
Expand|Select|Wrap|Line Numbers
  1. typedef unsigned char __u_char;
  2. typedef unsigned short int __u_short;
  3. typedef unsigned int __u_int;
  4. typedef unsigned long int __u_long;
  5.  
  6.  
  7. typedef signed char __int8_t;
  8.  
I would create a new source code file and put these lines in it. Then I would compile the file to be sure everything is fine.

Then above these lines I would add:

Expand|Select|Wrap|Line Numbers
  1. # 28 "/usr/include/bits/types.h" 2 3 4
  2.  
so the fie looks like:

Expand|Select|Wrap|Line Numbers
  1. # 28 "/usr/include/bits/types.h" 2 3 4
  2.  
  3. typedef unsigned char __u_char;
  4. typedef unsigned short int __u_short;
  5. typedef unsigned int __u_int;
  6. typedef unsigned long int __u_long;
  7.  
  8.  
  9. typedef signed char __int8_t;
and compile this. If this works add the next line, recompile and verify it still works. Keep working up until the compiler produces an error. The error should be in the last fle you added in.
Apr 12 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
5
by: Sönke Tesch | last post by:
Hi everybody, I have a problem with the following piece of code: 141: /* A data block to manage a single log target: */ 142: typedef struct { 143: apr_reslist_t *dbs; /* connection pool */...
4
by: Stephen Corey | last post by:
I've got 2 classes in 2 seperate header files, but within the same namespace. If I use a line like: // This code is inside Class2's header file Class1 *newitem = new Class1(param1, param2); ...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
2
by: Bob Alston | last post by:
I am going blind tonight but I cannot figure out the error. I get a syntax error from this sql statement, being run via vba in access 2003 insert into tbl_Volunteer_Donor in...
2
by: J W | last post by:
I have an ASP page in which there is embedded SQL. I am trying to use variables in the SQL but am getting the error 'syntax error or access violation'. In the past, I have successfully used...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
6
by: Pixel.to.life | last post by:
So I have this perfectly fine and running app, that uses managed C++ forms. Problem#1: I pass a Bitmap reference to a class, hoping to modify it in one of the class's methods, so it...
0
by: Alexis Boutillier | last post by:
Timothy Grant a écrit : As you can see in my last response, this problem is not linked to the type of error, If I "raise" a SystemError instead of creating a SyntaxError I still can't access...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.