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

benign redefinition of type

Hello
I am trying to compile a dll with the below code used to search through an
array of node structures.
I am getting the following warning unfortunately:

//wordsmain.c
#include <windows.h>
#include "resource.h"

typedef struct tagNODE
{
long StartCharNo,
EndCharNo,
NumChars,
NumChildren,
Type,
NextSibling;
char Chars[32];
long Children[24];
} NODE;
BOOL dataloaded = FALSE;
NODE* pData = NULL;

extern IMAGE_DOS_HEADER __ImageBase;
#define HMOD_THISCOMPONENT ((HMODULE)&__ImageBase)

void LoadData()
{
HRSRC hRsrc;
if(dataloaded) return;
hRsrc = FindResource(HMOD_THISCOMPONENT, MAKEINTRESOURCE(IDR_NODES),
"NODES");
if(hRsrc != NULL)
{
HGLOBAL hgData = LoadResource(HMOD_THISCOMPONENT, hRsrc);
if(hgData != NULL)
{
pData = (NODE*)LockResource(hgData);
dataloaded = TRUE;
}
} //hRsrc != NULL
}

long SearchMultipleNodes(long nodenum, char* test, long length, long* resm)
{
NODE* startnode = pData + nodenum;
while(nodenum != -1)
{
long relation = SearchNode(nodenum, test, length, resm);
if(relation > 0) return 1;
if(relation < 0) return -1;
nodenum = ((NODE*)(pData + nodenum))->NextSibling;
}
return -2;
}

long SearchNode(long nodenum, char* test, long length, long* res)
{ // ******* C4142 : benign redefinition of type occurs on this line
************
NODE* node = pData + nodenum;
long i, comp = 0;
for(i = node->StartCharNo; i <= node->EndCharNo; i++)
{
char ctest, cme;
if(i >= length) return 1;
ctest = test[i];
cme = node->Chars[i - node->StartCharNo];
if(ctest == cme) continue;
return (ctest < cme) ? -1 : 1;
}
if((node->Type != -1) && ((length - 1) == node->EndCharNo))
{
*res = node->Type;
return 0;
}
if(node->NumChildren > 0)
return SearchMultipleNodes(node->Children[0], test, length, res);
else return -2;
}

long GetWordType(char* test, long length)
{
long typeres,
res = SearchMultipleNodes(0, test, length, &typeres);
if(res == -2) return res;
else return typeres;
}

My compilation options are
cl /Zi /c /nologo wordsmain.c
should I be using more? it seems a pretty flimsy command line.
I can't find 'owt on't. tinternet about it.

Any other ideas?
Nov 17 '05 #1
1 2394
i figured it don't worry

"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:O7**************@TK2MSFTNGP15.phx.gbl...
Hello
I am trying to compile a dll with the below code used to search through an
array of node structures.
I am getting the following warning unfortunately:

//wordsmain.c
#include <windows.h>
#include "resource.h"

typedef struct tagNODE
{
long StartCharNo,
EndCharNo,
NumChars,
NumChildren,
Type,
NextSibling;
char Chars[32];
long Children[24];
} NODE;
BOOL dataloaded = FALSE;
NODE* pData = NULL;

extern IMAGE_DOS_HEADER __ImageBase;
#define HMOD_THISCOMPONENT ((HMODULE)&__ImageBase)

void LoadData()
{
HRSRC hRsrc;
if(dataloaded) return;
hRsrc = FindResource(HMOD_THISCOMPONENT, MAKEINTRESOURCE(IDR_NODES),
"NODES");
if(hRsrc != NULL)
{
HGLOBAL hgData = LoadResource(HMOD_THISCOMPONENT, hRsrc);
if(hgData != NULL)
{
pData = (NODE*)LockResource(hgData);
dataloaded = TRUE;
}
} //hRsrc != NULL
}

long SearchMultipleNodes(long nodenum, char* test, long length, long*
resm)
{
NODE* startnode = pData + nodenum;
while(nodenum != -1)
{
long relation = SearchNode(nodenum, test, length, resm);
if(relation > 0) return 1;
if(relation < 0) return -1;
nodenum = ((NODE*)(pData + nodenum))->NextSibling;
}
return -2;
}

long SearchNode(long nodenum, char* test, long length, long* res)
{ // ******* C4142 : benign redefinition of type occurs on this line
************
NODE* node = pData + nodenum;
long i, comp = 0;
for(i = node->StartCharNo; i <= node->EndCharNo; i++)
{
char ctest, cme;
if(i >= length) return 1;
ctest = test[i];
cme = node->Chars[i - node->StartCharNo];
if(ctest == cme) continue;
return (ctest < cme) ? -1 : 1;
}
if((node->Type != -1) && ((length - 1) == node->EndCharNo))
{
*res = node->Type;
return 0;
}
if(node->NumChildren > 0)
return SearchMultipleNodes(node->Children[0], test, length, res);
else return -2;
}

long GetWordType(char* test, long length)
{
long typeres,
res = SearchMultipleNodes(0, test, length, &typeres);
if(res == -2) return res;
else return typeres;
}

My compilation options are
cl /Zi /c /nologo wordsmain.c
should I be using more? it seems a pretty flimsy command line.
I can't find 'owt on't. tinternet about it.

Any other ideas?

Nov 17 '05 #2

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

Similar topics

5
by: lomat | last post by:
Hello, While compiling a file, I get following error .... ================================= /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/include/g++/type_traits.h:14 2: redefinition of...
1
by: A | last post by:
Hi, I created an array of user defined objects dynamically in a class Foo's constructor. class Foo{ Foo(){ Bar* b = new Bar(); }
1
by: squallions | last post by:
Hi I doing my c++ homework and stuck on error 'class' type redefinition. I have 5 classes. First class is base class. The next two classes are derived from the first class. The next two...
3
by: cody | last post by:
Hello fols. I'm doin a school project and have this stupid problem. We're on virtual functions and have to seperate out each class into a file. There are 9 classes and so 9 .h and .c files. the...
9
by: john hrdo | last post by:
Hey, This might well be a naive question, please be patient. Is it possible to compile a C program including two libraries lib1 and lib2 which have both a function with same name, e.g....
1
by: Alex | last post by:
Hello all, I have a very stupid problem that is driving me crazy...so plz if anyone ever saw this, I would like him to help me :) I have static MFC application in MSVC++ 6.0 (named Example)....
1
by: Martin.C.Johnsson | last post by:
Hi, I have the following problem The below class is fully defined in the header file thus there's no ..cpp-file. The header-file is included in several lib's I'm using. ---------- #pragma once...
2
by: Mohammad Omer | last post by:
Hi, i am developing an application which uses WAB API's, for doing all this i am using vs2k5. I have wab.h header file included in my project to use WAB api's but after compilation one error...
0
by: =?Utf-8?B?Sm9obkE=?= | last post by:
When adding a "Managed Assembly" i.e., a dll to an existing C++/CLI program i get the error: LDAPfunctions.h(183) : error C2011: 'LDAPfunctions::LdapSsl' : 'class' type redefinition This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.