cancel
Showing results for 
Search instead for 
Did you mean: 

string.h library and strncmp function

pietruha8
Associate II
Posted on June 30, 2011 at 00:16

Hi,

I want to use strncmp function in my code [ if (strnicmp(temp, GPVTG, 5)) ], but I've got an error:

&sharperror cpstm8 ..\..\src\main.c:278(12) missing prototype

I have string.h file in my include files, but I think that is not enough ;], what should i do now?

#rtfm
7 REPLIES 7
Posted on June 30, 2011 at 13:14

''string.h library''

 

 

Note that string.h is a so-called ''Header'' file - it is

not

a library!

In addition to the header file, you will also require the appropriate library.

''#error cpstm8 ..\..\src\main.c:278(12) missing prototype''

The words seem perfectly clear & plain: the function protoype is missing; ie, not present.

''I have string.h file in my include files''

 

Have you checked that it does actually contain a prototype for the function that gives the above error?

pietruha8
Associate II
Posted on July 01, 2011 at 14:08

From where can i get whole library?

int    strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); is in my header, so now i need c file with this function witch is in library?
Posted on July 01, 2011 at 15:16

''From where can i get whole library?''

 

Your compiler manuals wll tell you that.

''int    strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); is in my header''

 

 

But you said you wanted to use strncmp - not strnicmp.

 

''so now i need c file with this function witch is in library?''

Not necessarily.

Most likely, your compiler will not provide it as a 'C' source file - but as (part of) a library.

Again, you will have to study your compiler manuals for details.
jdf25252
Associate II
Posted on July 01, 2011 at 18:28

Okelm

Based on the error message you're getting I'm assuming that you have the Cosmic compiler.  If you're using STVD I'd suggest first looking at your ''Project Settings'' and the ''General'' tab. Your toolset should be ''STM8 Cosmic''  AND you should check the ''Project specific toolset path'' box.  The ''Root path'' on my system is ''C:\Program Files\COSMIC\CXSTM8''  When you do this the other path boxes should automatically fill. ''Bin path'' - Blank, ''Include path'' = ''Hstm8'' & ''Library path'' = ''Lib''

Try removing your own function prototype and include string.h again.

#include <string.h>

Once the correct paths are set up you shouldn't have to mess with finding the headers or libraries.

STVD is pretty poorly documented & you learn these things with years of hand-to-hand combat. 

Have fun

& good luck.

jdf

pietruha8
Associate II
Posted on July 02, 2011 at 21:53

Thanks,

but after changing those paths problem still exist. I'm sending my code and errors in attached files.

jdf25252
Associate II
Posted on July 05, 2011 at 16:23

sigh!  Screen captures aren't terribly useful.  I'm certainly not going to retype your code nor would anyone else.  Zip up all your .c & .h files for your project & include the stp file.  Then maybe we can find an answer for you.

jdf

luca239955_stm1_st
Senior II
Posted on July 06, 2011 at 12:00

you declare ''temp'' as a char and then try to use it as an array... most of the errors in the screen captures come from there, although the original error is probably due to something else..