473,320 Members | 1,746 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,320 software developers and data experts.

compiling errors cannot understand

Hello All,
tp.c:107: error: syntax error before '*' token
tp.c:108: warning: function declaration isn't a prototype
tp.c:121: error: syntax error before '*' token
tp.c:122: warning: function declaration isn't a prototype
tp.c:135: error: syntax error before '*' token
tp.c:138: warning: return type defaults to `int'
tp.c:138: warning: no previous prototype for 'test_modevent'
tp.c: In function `test_modevent':
tp.c:143: warning: assignment from incompatible pointer type
*** Error code 1
************************************************** *
This is the error code that i am getting on gcc conpiler but i dont
understand what could be wrong
i also attach that part of the code here
************************************************** *
struct drv_t {
char name [8];
struct cdev *devt;
};

//static void test_ifstart (drv_t *d);
//static void test_ifwatchdog (drv_t *d);
//static void test_initialize (void *softc);
//static int test_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);

static void test_ifstart (drv_t *d)
{
uprintf("inside start\n");
return;

}

Kindly help me in sorting this problem
Thanks and regards,
Rashmi

Nov 15 '05 #1
5 1593
rashmi wrote:
tp.c:107: error: syntax error before '*' token [...] struct drv_t {
char name [8];
struct cdev *devt;
}; [...] static void test_ifstart (drv_t *d)


In C (other than in C++) a struct/union/enum does not introduce a new type.
Therefore, you need to write
static void test_ifstart (struct drv_t *d)
or use a typedef to make it a type:
typedef struct drv_t drv_t;

Uli

Nov 15 '05 #2
Thank you it really worked
--
rasmi

Nov 15 '05 #3
Ulrich Eckhardt wrote:
rashmi wrote:
tp.c:107: error: syntax error before '*' token [...]
struct drv_t {
char name [8];
struct cdev *devt;
};

[...]
static void test_ifstart (drv_t *d)


In C (other than in C++) a struct/union/enum does not introduce a
new type.


Yes, it does.
Therefore, you need to write
static void test_ifstart (struct drv_t *d)
or use a typedef to make it a type:
typedef struct drv_t drv_t;


This is because struct tags are not visible as automatic typedef names
(or whatever C++ does), not because struct is not a new type.

--
Peter

Nov 15 '05 #4
Ulrich Eckhardt <do******@knuut.de> writes:
rashmi wrote:
tp.c:107: error: syntax error before '*' token [...]
struct drv_t {
char name [8];
struct cdev *devt;
};

[...]
static void test_ifstart (drv_t *d)


In C (other than in C++) a struct/union/enum does not introduce a new type.


Yes, it does introduce a new type. The difference is that the tag is
in a separate namespace; it's not directly visible without the
struct/union/enum keyword in front of it.
Therefore, you need to write
static void test_ifstart (struct drv_t *d)
or use a typedef to make it a type:
typedef struct drv_t drv_t;


Right.

It's often argued that the typedef is a bad idea. It serves to hide
the fact that the type is a struct; it's usually better to make that
explicit.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #5
Ulrich Eckhardt <do******@knuut.de> wrote:
[...]
In C [...] a struct/union/enum does not introduce a new type.
On the contrary, as already correctly pointed out by others.

To put even more emphasis on the fact that these keywords actually
declare new types: it can be (and has been, e.g. by Chris Torek)
argued, that it's reasonable to think of "struct" actually /meaning/
"type"!
[...] you need to write
static void test_ifstart (struct drv_t *d)
or use a typedef to make it a type:
typedef struct drv_t drv_t;


Right. Notice however, that the keyword "typedef" does not declare a
new type, but merely declares a typename-alias for an existing type,
covering up the nature of this type. This is often considered a Bad
Thing[tm] to do, at least by a significant number of regulars in this
group, AFAICT.

Best Regards.
--
Irrwahn Grausewitz (ir*******@freenet.de)
welcome to clc : http://www.ungerhu.com/jxh/clc.welcome.txt
clc faq-list : http://www.faqs.org/faqs/C-faq/faq/
clc frequent answers: http://benpfaff.org/writings/clc.
Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob F | last post by:
I am trying to compile a string class which was working before but subsequent attempts to make it more 'object orientated' (privatizing the member variables and implenting query functions) it...
0
by: David W. Fenton | last post by:
Today I was working on a hideous old app that I created a long time ago that does a lot of showing/hiding/resizing of fields on one of the forms. I had used constants to store reference values for...
1
by: rashmi | last post by:
Hi All, ************************************************* error: variable `hdlc_cdevsw' has initializer but incomplete type *************************************************** This is the error...
3
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody have a problem compiling some solution in VS2003? I get the error every time that some files are locked and are using by another process. I repeat compiling again and again...
1
by: Jim Heavey | last post by:
Hello, trying to round out my knowlege here about compiling. To date I have used VS.Net to do all my compiling "majically", but I want to understand how to do it on my own, should the need ever...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
23
by: Babak | last post by:
Hi Everyone, I've written a standard C code for a simple finite element analysis in MSVC++ . When I save the file as a cpp file, it compiles and runs perfectly, but when I save it as a c file,...
0
by: Pucca | last post by:
Hi I'm using vs2005. I am getting a bunch of compiler warnings after I made some changes to my code that was compiling clean. I'm also getting memory errors when I run my program and it's...
8
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
2
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.