Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic strstr() function not defined? (Read 1954 times)
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
strstr() function not defined?
Feb 12th, 2020 at 3:15pm
Print Post  
Hey!

I'm trying to use the standard strings library with the Nucleo-64 STM32L452RE board but when i type the code:

Code (C++)
Select All
const char * someString = "Hello";
strstr(someString, "llo"); 



The intellisense engine puts a red squiggly under it and says that it has too many arguments?

« Last Edit: Feb 12th, 2020 at 3:15pm by Bambo »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: strstr() function not defined?
Reply #1 - Feb 12th, 2020 at 6:20pm
Print Post  
The intellisense for the stm32 has been improved in the next release. If you click F12 or GoTo on the strstr() you will see that the method is wrapped in a special gcc EXTFUNC() call that then adds the code of the funition "inline".

Before the next release you have intellisense workaround the problem by adding a "__vm\vs-intellisense-fix.h" to the project folder. The .h does NOT actually have to be included in the project or referenced in your code. 

After adding the vs-intellisense-fix.h then past the following code into it and click build to force an intellisense refresh.


Code (C++)
Select All
#pragma once

_PTR 	 memchr(const _PTR, int, size_t);
_PTR 	 memchr(const _PTR, int, size_t) {}
int 	  memcmp(const _PTR, const _PTR, size_t);
_PTR 	  memcpy(_PTR __restrict, const _PTR __restrict, size_t);
_PTR	  memmove(_PTR, const _PTR, size_t);
_PTR	  memset(_PTR, int, size_t);
_PTR	  memset(_PTR, int, size_t) {}
char* strcat(char* __restrict, const char* __restrict);
char* strcat(char* __restrict, const char* __restrict) {}
char* strchr(const char*, int);
char* strchr(const char*, int) {};
int	  strcmp(const char*, const char*);
int	  strcmp(const char*, const char*) {}
int	  strcoll(const char*, const char*);
int	  strcoll(const char*, const char*) {}
char* strcpy(char* __restrict, const char* __restrict);
char* strcpy(char* __restrict, const char* __restrict) {}
size_t	  strcspn(const char*, const char*);
size_t	  strcspn(const char*, const char*) {}
char* strerror(int);
char* strerror(int) {}
size_t	  strlen(const char*);
size_t	  strlen(const char*) {}
char* strncat(char* __restrict, const char* __restrict, size_t);
char* strncat(char* __restrict, const char* __restrict, size_t) {}
int	  strncmp(const char*, const char*, size_t);
int	  strncmp(const char*, const char*, size_t) {}
char* strncpy(char* __restrict, const char* __restrict, size_t);
char* strncpy(char* __restrict, const char* __restrict, size_t) {}
char* strpbrk(const char*, const char*);
char* strpbrk(const char*, const char*) {}
char* strrchr(const char*, int);
char* strrchr(const char*, int) {}
size_t	  strspn(const char*, const char*);
size_t	  strspn(const char*, const char*) {}
char 	* strstr (const char *, const char *);
char 	* strstr(const char *, const char *){}
#ifndef _REENT_ONLY
char* strtok(char* __restrict, const char* __restrict);
char* strtok(char* __restrict, const char* __restrict) {}
#endif
size_t	  strxfrm(char* __restrict, const char* __restrict, size_t);
size_t	  strxfrm(char* __restrict, const char* __restrict, size_t) {}

#if __POSIX_VISIBLE >= 200809
int	 strcoll_l(const char*, const char*, locale_t);
int	 strcoll_l(const char*, const char*, locale_t) {}
char* strerror_l(int, locale_t);
char* strerror_l(int, locale_t) {}
size_t	 strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
size_t	 strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t) {}
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict) {}
#endif

#if __BSD_VISIBLE
int	  timingsafe_bcmp(const void*, const void*, size_t);
int	  timingsafe_bcmp(const void*, const void*, size_t) {}
int	  timingsafe_memcmp(const void*, const void*, size_t);
int	  timingsafe_memcmp(const void*, const void*, size_t) {}
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE
//_PTR	  memccpy (_PTR __restrict, const _PTR __restrict, int, size_t);
#endif

#if __GNU_VISIBLE
_PTR	  mempcpy (_PTR, const _PTR, size_t);
_PTR	  memmem (const _PTR, size_t, const _PTR, size_t);
_PTR 	  memrchr (const _PTR, int, size_t);
_PTR 	  rawmemchr (const _PTR, int);
#endif

#if __POSIX_VISIBLE >= 200809
char* stpcpy(char* __restrict, const char* __restrict);
char* stpcpy(char* __restrict, const char* __restrict) {}
char* stpncpy(char* __restrict, const char* __restrict, size_t);
char* stpncpy(char* __restrict, const char* __restrict, size_t) {}
#endif

#if __GNU_VISIBLE
char* strcasestr (const char*, const char*);
char* strchrnul (const char*, int);
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
char* strdup(const char*);
char* strdup(const char*) {}
#endif
char* _strdup_r(struct _reent*, const char*);
char* _strdup_r(struct _reent*, const char*) {}
#if __POSIX_VISIBLE >= 200809
char* strndup(const char*, size_t);
char* strndup(const char*, size_t) {}
#endif
char* _strndup_r(struct _reent*, const char*, size_t);
char* _strndup_r(struct _reent*, const char*, size_t) {}

 



This is an area (intellisense) that will improve when we move from VC++ proejcts to clang.
« Last Edit: Feb 12th, 2020 at 6:21pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Bambo
Member
***
Offline


Posts: 146
Location: Liverpool, UK
Joined: Jan 13th, 2020
Re: strstr() function not defined?
Reply #2 - Feb 12th, 2020 at 7:25pm
Print Post  
Tim@Visual Micro wrote on Feb 12th, 2020 at 6:20pm:
The intellisense for the stm32 has been improved in the next release. If you click F12 or GoTo on the strstr() you will see that the method is wrapped in a special gcc EXTFUNC() call that then adds the code of the funition "inline".

Before the next release you have intellisense workaround the problem by adding a "__vm\vs-intellisense-fix.h" to the project folder. The .h does NOT actually have to be included in the project or referenced in your code. 

After adding the vs-intellisense-fix.h then past the following code into it and click build to force an intellisense refresh.


Code (C++)
Select All
#pragma once

_PTR 	 memchr(const _PTR, int, size_t);
_PTR 	 memchr(const _PTR, int, size_t) {}
int 	  memcmp(const _PTR, const _PTR, size_t);
_PTR 	  memcpy(_PTR __restrict, const _PTR __restrict, size_t);
_PTR	  memmove(_PTR, const _PTR, size_t);
_PTR	  memset(_PTR, int, size_t);
_PTR	  memset(_PTR, int, size_t) {}
char* strcat(char* __restrict, const char* __restrict);
char* strcat(char* __restrict, const char* __restrict) {}
char* strchr(const char*, int);
char* strchr(const char*, int) {};
int	  strcmp(const char*, const char*);
int	  strcmp(const char*, const char*) {}
int	  strcoll(const char*, const char*);
int	  strcoll(const char*, const char*) {}
char* strcpy(char* __restrict, const char* __restrict);
char* strcpy(char* __restrict, const char* __restrict) {}
size_t	  strcspn(const char*, const char*);
size_t	  strcspn(const char*, const char*) {}
char* strerror(int);
char* strerror(int) {}
size_t	  strlen(const char*);
size_t	  strlen(const char*) {}
char* strncat(char* __restrict, const char* __restrict, size_t);
char* strncat(char* __restrict, const char* __restrict, size_t) {}
int	  strncmp(const char*, const char*, size_t);
int	  strncmp(const char*, const char*, size_t) {}
char* strncpy(char* __restrict, const char* __restrict, size_t);
char* strncpy(char* __restrict, const char* __restrict, size_t) {}
char* strpbrk(const char*, const char*);
char* strpbrk(const char*, const char*) {}
char* strrchr(const char*, int);
char* strrchr(const char*, int) {}
size_t	  strspn(const char*, const char*);
size_t	  strspn(const char*, const char*) {}
char 	* strstr (const char *, const char *);
char 	* strstr(const char *, const char *){}
#ifndef _REENT_ONLY
char* strtok(char* __restrict, const char* __restrict);
char* strtok(char* __restrict, const char* __restrict) {}
#endif
size_t	  strxfrm(char* __restrict, const char* __restrict, size_t);
size_t	  strxfrm(char* __restrict, const char* __restrict, size_t) {}

#if __POSIX_VISIBLE >= 200809
int	 strcoll_l(const char*, const char*, locale_t);
int	 strcoll_l(const char*, const char*, locale_t) {}
char* strerror_l(int, locale_t);
char* strerror_l(int, locale_t) {}
size_t	 strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t);
size_t	 strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t) {}
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict);
char* strtok_r(char* __restrict, const char* __restrict, char** __restrict) {}
#endif

#if __BSD_VISIBLE
int	  timingsafe_bcmp(const void*, const void*, size_t);
int	  timingsafe_bcmp(const void*, const void*, size_t) {}
int	  timingsafe_memcmp(const void*, const void*, size_t);
int	  timingsafe_memcmp(const void*, const void*, size_t) {}
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE
//_PTR	  memccpy (_PTR __restrict, const _PTR __restrict, int, size_t);
#endif

#if __GNU_VISIBLE
_PTR	  mempcpy (_PTR, const _PTR, size_t);
_PTR	  memmem (const _PTR, size_t, const _PTR, size_t);
_PTR 	  memrchr (const _PTR, int, size_t);
_PTR 	  rawmemchr (const _PTR, int);
#endif

#if __POSIX_VISIBLE >= 200809
char* stpcpy(char* __restrict, const char* __restrict);
char* stpcpy(char* __restrict, const char* __restrict) {}
char* stpncpy(char* __restrict, const char* __restrict, size_t);
char* stpncpy(char* __restrict, const char* __restrict, size_t) {}
#endif

#if __GNU_VISIBLE
char* strcasestr (const char*, const char*);
char* strchrnul (const char*, int);
#endif

#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4
char* strdup(const char*);
char* strdup(const char*) {}
#endif
char* _strdup_r(struct _reent*, const char*);
char* _strdup_r(struct _reent*, const char*) {}
#if __POSIX_VISIBLE >= 200809
char* strndup(const char*, size_t);
char* strndup(const char*, size_t) {}
#endif
char* _strndup_r(struct _reent*, const char*, size_t);
char* _strndup_r(struct _reent*, const char*, size_t) {}

 



This is an area (intellisense) that will improve when we move from VC++ proejcts to clang.


Excellent news! Clang is awesome! Thanks Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint