Solved

C Source code Compile Warnings

Posted on 2006-07-05
6
618 Views
Last Modified: 2012-08-14
Hello I am getting 5 different type of Warnings: when I build my C source module
( I am new in C source code)

Any remedy / suggestions or fixes will be greatly helpfull

Thanks
Shaw



They are followings:

1. /export/home/n9911742/Delta_Files/temp/vrtb02a2.c", line 117: warning: no explicit type given
2. /export/home/n9911742/Delta_Files/temp/vrtb02a2.c, line 2093: warning: implicit function declaration: UTL_C
SDateToSqlDate
3. /opt/vii/scm2src/prd/source/inc/virtuoso.h", line 2108: warning: macro redefined: INHERIT_PARENT
4. ld: warning: symbol `OP_Error_Return' has differing sizes:
        (file /opt/vii/scm2/prd-holdexe/lib/libvicss.so value=0x2c; file /opt/vii/scm2/prd-holdexe/lib/libvic
sd.so value=0x20);
5. /export/home/n9911742/Delta_Files/temp/vpay22s.c, line 753: warning: improper pointer/integer combination: arg #2
0
Comment
Question by:dmshawkat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:_iskywalker_
ID: 17046310
without any code is quite hardly tio analyse
0
 

Author Comment

by:dmshawkat
ID: 17046491
Following is the exerpt of the code, though I just want to get an idea, generally
what are the probable cause of these type warnings :)

/* SQLLIB Prototypes */

117 : extern sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

2062: sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);


0
 
LVL 1

Accepted Solution

by:
i_mahesh earned 63 total points
ID: 17047411
1. In C it is allowed to define a function withought a return type, in this case the compiler will assume a default int return type. When the return type is not mentioned the new C compilers will issue a warning and internally treat the return type as int. It is advisable to explecitly mention the return type of all the functions.

  for eg in the code provided by you
extern sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

can be rewritten as
extern int sqlcxt (/*_ void **, unsigned int *,
                   struct sqlexd *, struct sqlcxp * _*/);

or whatver datatype is applicable.


2. No idea about this

3. This warning is issued when there is redefination of the macro. This situation may occur in the following scenarios.

    a. The macro with the same name is defined in different files in your source.
    b. The header in which the macro is defined has been included multiple times across the sources.

   in the first case it is advisable to define the macro only in only place and include the file wherever needed.

   In the second case one should enclose the header file in the #ifndef block to avoid multiple inclusions. for eg.

the starting and the end lines of the header file will look like

#ifndef __INCLUDED_THIS_HEADER__
#define __INCLUDED_THIS_HEADER__
.....
...
//Your definations go here
....
#endif //__INCLUDED_THIS_HEADER__

4. another case of redefination
5. Its a case where you are passing integer value where a pointer is expected as argument to the function or vice versa

Hope this helps you.
0
 
LVL 11

Assisted Solution

by:cup
cup earned 62 total points
ID: 17049496
2. You've used the function without defining a prototype so it is making up a prototype for you with the default type of int.

4. Is the same as 2.  You've called the routine in one place without defining a prototype so it assumes a return value of int.  You've declared it somewhere else with a return value of say char* or anything except int.  The return types don't match, hence the error
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question