473,659 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PLEASE, PLEASE HELP - Compile time error message

Could someone please help me? I have the following C struct.
typedef struct
_FIREWALL_RULE_ INFO
{
ULONG Precedence;
BOOL bEnabled;
BOOL bLoggingEnabled ;
BOOL bAllowFragments ;
BOOL bAllowInbound; /* only used
if 'SohoFirewallMo del' is enabled */
BOOL bAllowOutbound; /* only used
if 'SohoFirewallMo del' is enabled */
ULONG SessionTimeout; /* override
the session timeout value, in minutes */

ULONG Action;
BOOL bAnyService;
char
ServiceName[BOND_SERVICE_NA ME_SIZE ];

BOOL bSrcAllIpAddrs;
BOND_ADDRESS_PO OL SrcIpAddrPool;
BOOL bDstAllIpAddrs;
BOND_ADDRESS_PO OL DstIpAddrPool;

BOOL bBwmEnabled;
ULONG BwmType;
ULONG GuaBandwidthInK bps;
ULONG MaxBandwidthInK bps;
ULONG Priority;

BOND_ADDRESS_GR OUP SrcIpAddrGroup; /* this field
is for internal use only */
BOND_ADDRESS_GR OUP DstIpAddrGroup; /* this field
is for internal use only */
}
FIREWALL_RULE_I NFO, *PFIREWALL_RULE _INFO;

I get the following compile time error message, while compiling a
function that clones a FIREWALL_RULE_I NFO struct.

request for member `MaxBandwidthIn Kbps' in something not a structure
or union

Could someone please point out what I might be doing wrong? Thanks in
advance for your help.

Nov 14 '07 #1
4 1829
On Nov 14, 1:44 pm, "cpptutor2...@y ahoo.com" <cpptutor2...@y ahoo.com>
wrote:
Could someone please help me? I have the following C struct.
typedef struct
_FIREWALL_RULE_ INFO
{
ULONG Precedence;
BOOL bEnabled;
BOOL bLoggingEnabled ;
BOOL bAllowFragments ;
BOOL bAllowInbound; /* only used
if 'SohoFirewallMo del' is enabled */
BOOL bAllowOutbound; /* only used
if 'SohoFirewallMo del' is enabled */
ULONG SessionTimeout; /* override
the session timeout value, in minutes */

ULONG Action;
BOOL bAnyService;
char
ServiceName[BOND_SERVICE_NA ME_SIZE ];

BOOL bSrcAllIpAddrs;
BOND_ADDRESS_PO OL SrcIpAddrPool;
BOOL bDstAllIpAddrs;
BOND_ADDRESS_PO OL DstIpAddrPool;

BOOL bBwmEnabled;
ULONG BwmType;
ULONG GuaBandwidthInK bps;
ULONG MaxBandwidthInK bps;
ULONG Priority;

BOND_ADDRESS_GR OUP SrcIpAddrGroup; /* this field
is for internal use only */
BOND_ADDRESS_GR OUP DstIpAddrGroup; /* this field
is for internal use only */}

FIREWALL_RULE_I NFO, *PFIREWALL_RULE _INFO;

I get the following compile time error message, while compiling a
function that clones a FIREWALL_RULE_I NFO struct.

request for member `MaxBandwidthIn Kbps' in something not a structure
or union

Could someone please point out what I might be doing wrong? Thanks in
advance for your help.
Missing are definitions for BOOL, ULONG, BOND_ADDRESS_PO OL,
BOND_SERVICE_NA ME_SIZE, BOND_ADDRESS_GR OUP

Missing is the bit of code where you try to use it.

But, upon donning my Karnak hat, I can easily see that you have made a
mistake in your code somewhere.

Nov 14 '07 #2
In article <11************ **********@19g2 000hsx.googlegr oups.com>,
cp**********@ya hoo.com <cp**********@y ahoo.comwrote:
>Could someone please help me? I have the following C struct.
typedef struct
_FIREWALL_RULE _INFO
{
ULONG Precedence;
[...]
ULONG MaxBandwidthInK bps;
}
FIREWALL_RULE_ INFO, *PFIREWALL_RULE _INFO;
>I get the following compile time error message, while compiling a
function that clones a FIREWALL_RULE_I NFO struct.
>request for member `MaxBandwidthIn Kbps' in something not a structure
or union
Perhaps at that point, you have something like

thisthing.MaxBa ndwidthInKbps

and it is complaining because thisthing is not a structure or union.
If, for example, thisthing was a -pointer- to a structure then
you would use thisthing->MaxBandwidthIn Kbps instead of
thisthing.MaxBa ndwidthInKbps

(Given your comment about the function cloning the struct, your
code might have thisthing->MaxBandwidthIn Kbps
except that instead of thisthing being a pointer to the
structure, you have it as a pointer to a pointer to the structure,
needing (*thisthing)->MaxBandwidthIn Kbps )
--
"Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us." -- Ecclesiastes
Nov 14 '07 #3
cp**********@ya hoo.com wrote:
Could someone please help me? I have the following C struct.
typedef struct
_FIREWALL_RULE_ INFO
{
ULONG Precedence;
BOOL bEnabled;
BOOL bLoggingEnabled ;
BOOL bAllowFragments ;
BOOL bAllowInbound; /* only used
if 'SohoFirewallMo del' is enabled */
BOOL bAllowOutbound; /* only used
if 'SohoFirewallMo del' is enabled */
ULONG SessionTimeout; /* override
the session timeout value, in minutes */

ULONG Action;
BOOL bAnyService;
char
ServiceName[BOND_SERVICE_NA ME_SIZE ];

BOOL bSrcAllIpAddrs;
BOND_ADDRESS_PO OL SrcIpAddrPool;
BOOL bDstAllIpAddrs;
BOND_ADDRESS_PO OL DstIpAddrPool;

BOOL bBwmEnabled;
ULONG BwmType;
ULONG GuaBandwidthInK bps;
ULONG MaxBandwidthInK bps;
ULONG Priority;

BOND_ADDRESS_GR OUP SrcIpAddrGroup; /* this field
is for internal use only */
BOND_ADDRESS_GR OUP DstIpAddrGroup; /* this field
is for internal use only */
}
FIREWALL_RULE_I NFO, *PFIREWALL_RULE _INFO;

I get the following compile time error message, while compiling a
function that clones a FIREWALL_RULE_I NFO struct.

request for member `MaxBandwidthIn Kbps' in something not a structure
or union

Could someone please point out what I might be doing wrong? Thanks in
advance for your help.
What you're doing wrong is failing to show us the code that causes the error.
You say you have a function that "clones" (what exactly does that mean?) a
FIREWALL_RULE_I NFO struct. The compiler isn't complaining about the function;
it's complaining about some specific construct in the function. And it's
telling you (by showing the line number) exactly which construct it doesn't like
-- but you're not telling us.

Always show the *exact* code that produces an error, along with the *exact*
error message. Copy-and-paste both; don't try to summarize or re-type.

The above declares a type "struct _FIREWALL_RULE_ INFO" (which is unwise;
identifiers starting with "_" and an uppercase letter are reserved to the
implementation) . It declares "FIREWALL_RULE_ INFO" as an alias for this type,
and "PFIREWALL_RULE _INFO" for "pointer to struct _FIREWALL_RULE_ INFO".

My guess (and it's only a guess) is that you have something of type
"PFIREWALL_RULE _INFO", and you're trying to apply ".MaxBandwidthI nKbps" to it.
For example:

PFIREWALL_RULE_ INFO ptr; /* ptr is a pointer to struct */
...
ptr.MaxBandwidt hInKbps /* ptr is a pointer, not a struct */

Either the prefix needs to be of type FIREWALL_RULE_I NFO, or you need to use the
"->" operator instead of the "." operator.

This illustrates one reason why it's almost always a bad idea to use a typedef
for a pointer type. If you simply declared your pointers as type
"*FIREWALL_RULE _INFO", it would be more obvious that they're pointers.

(I also question the wisdom of a typedef like "ULONG". If you mean unsigned
long, just use unsigned long. If there's any possibility that ULONG could be
something other than unsigned long, then ULONG is a lousy name.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Looking for software development work in the San Diego area.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 14 '07 #4
cp**********@ya hoo.com wrote:
Could someone please help me? I have the following C struct.
[OP's code is quoted at EOM]
I have rewritten your struct into C and provided both a clone function
and a main() driver. Compare your code (which you have kept secret) to
these.
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

typedef unsigned Bond_Address_Po ol, Bond_Address_Gr oup;
#define BOND_SERVICE_NA ME_SIZE 1

typedef struct
{
unsigned long Precedence;
bool bEnabled;
bool bLoggingEnabled ;
bool bAllowFragments ;
bool bAllowInbound; /* only used if 'SohoFirewallMo del' is
enabled */
bool bAllowOutbound; /* only used if 'SohoFirewallMo del' is
enabled */
unsigned long SessionTimeout; /* override the session timeout
value, in minutes */
unsigned long Action;
bool bAnyService;
char ServiceName[BOND_SERVICE_NA ME_SIZE];
bool bSrcAllIpAddrs;
Bond_Address_Po ol SrcIpAddrPool;
bool bDstAllIpAddrs;
Bond_Address_Po ol DstIpAddrPool;
bool bBwmEnabled;
unsigned long BwmType;
unsigned long GuaBandwidthInK bps;
unsigned long MaxBandwidthInK bps;
unsigned long Priority;
Bond_Address_Gr oup SrcIpAddrGroup; /* this field is for internal
use only */
Bond_Address_Gr oup DstIpAddrGroup; /* this field is for internal
use only */
}
Firewall_Rule_I nfo;

Firewall_Rule_I nfo *clone_firewall _rule(Firewall_ Rule_Info * in)
{
Firewall_Rule_I nfo *out;
if ((out = malloc(sizeof *out)))
memcpy(out, in, sizeof *out);
return out;
}

int main(void)
{
Firewall_Rule_I nfo original = {.MaxBandwidthI nKbps = 372586 }, *new;
new = clone_firewall_ rule(&original) ;
printf("MaxBand widthInKbps in original structure: %lu\n"
"MaxBandwidthIn Kbps in copy (*new) structure: %lu\n",
original.MaxBan dwidthInKbps, (*new).MaxBandw idthInKbps);
free(new);
return 0;
}

[output]
MaxBandwidthInK bps in original structure: 372586
MaxBandwidthInK bps in copy (*new) structure: 372586

[OP's code, etc.]
typedef struct
_FIREWALL_RULE_ INFO
{
ULONG Precedence;
BOOL bEnabled;
BOOL bLoggingEnabled ;
BOOL bAllowFragments ;
BOOL bAllowInbound; /* only used
if 'SohoFirewallMo del' is enabled */
BOOL bAllowOutbound; /* only used
if 'SohoFirewallMo del' is enabled */
ULONG SessionTimeout; /* override
the session timeout value, in minutes */

ULONG Action;
BOOL bAnyService;
char
ServiceName[BOND_SERVICE_NA ME_SIZE ];

BOOL bSrcAllIpAddrs;
BOND_ADDRESS_PO OL SrcIpAddrPool;
BOOL bDstAllIpAddrs;
BOND_ADDRESS_PO OL DstIpAddrPool;

BOOL bBwmEnabled;
ULONG BwmType;
ULONG GuaBandwidthInK bps;
ULONG MaxBandwidthInK bps;
ULONG Priority;

BOND_ADDRESS_GR OUP SrcIpAddrGroup; /* this field
is for internal use only */
BOND_ADDRESS_GR OUP DstIpAddrGroup; /* this field
is for internal use only */
}
FIREWALL_RULE_I NFO, *PFIREWALL_RULE _INFO;

I get the following compile time error message, while compiling a
function that clones a FIREWALL_RULE_I NFO struct.

request for member `MaxBandwidthIn Kbps' in something not a structure
or union

Could someone please point out what I might be doing wrong? Thanks in
advance for your help.
Nov 15 '07 #5

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

Similar topics

13
3053
by: Adam Blair | last post by:
Is it possible to bind a switch statement to an Enum such that a compile-time error is raised if not all values within the Enum are handled in the switch statement? I realise you can use default: to catch unhandled cases, but of course this is only at run-time. Example: public enum MyEnum { one, two, three, four }
25
2842
by: n3crius | last post by:
hi, i just got a web host with asp.net , seemed really cool. aspx with the c# or vb IN the actual main page run fine, but when i use codebehind and make another source file ( a .cs) to go with the aspx (as you would realistically) I get this : Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root...
10
2060
by: Rob Dob | last post by:
Hi, I'm amazed!!! I am using VS2005, I create a new web project, c# and then within the default.aspx form right mouse click and select "View Compnent Designer" , I then select and drag a SQLDataAdapter onto the designer. I then go through the wizard and create SQL Query. I then compile the project, I have add in a "InitializeComponent();" within the Page_Load, I then run the program. everything works okay,, as it does noting. ...
9
3505
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them has mandatory parameters, I mean, they should not be null nor empty (for strings). So I'd make the validation in the constructor and generate a compile-time error if the validation does not match... Is there a way to achieve this or to specify...
7
1775
by: rn5a | last post by:
This is the second time I am asking this question in this newsgroup since I haven't got a solution or response from anyone in my previous post & I need to resolve this issue desperately. Sorry for the double post but I just didn't have any other option other than re-posting the same question in this newsgroup. Consider the following code in a VB class file: Namespace LoginUserFetchDB Public Class ZForZebra : Inherits SoapHeader
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.