Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 10: error: ‘strcasecmp’ was not declared in this scope #110

Open
MBeijer opened this issue Jan 3, 2022 · 9 comments
Open

GCC 10: error: ‘strcasecmp’ was not declared in this scope #110

MBeijer opened this issue Jan 3, 2022 · 9 comments

Comments

@MBeijer
Copy link

MBeijer commented Jan 3, 2022

Hi!

I'm having trouble compiling a program since I updated to GCC 10, where I get the error

 error: ‘strcasecmp’ was not declared in this scope

even though I have these includes:

    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <strings.h>

or these:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <strings.h>

with -mcrt=newlib

I looked at the newlib includes and they seem to define the function, so it seems like it's not loading the proper includes from newlib for some reason.

I hope someone can help out with this!

@sodero
Copy link
Contributor

sodero commented Jan 4, 2022

How did you build the compiler? Are you cross compiling or building natively? What happens if you use -mcrt=clib2 instead?

@sodero
Copy link
Contributor

sodero commented Jan 4, 2022

Are you using using namespace std; / std::strcasecmp btw?

@MBeijer
Copy link
Author

MBeijer commented Jan 7, 2022

@sodero no, I'm not using using namespace std; nor std::strcasecmp but I tried using that now and I get this error instead:

error: ‘strcasecmp’ is not a member of ‘std’; did you mean ‘strcasecmp’?

😅

@sodero
Copy link
Contributor

sodero commented Jan 7, 2022

@MBeijer Does this work for you?

bild

Sorry about the weird way of showing example code. I have networking issues in my Amiga cave.

@sodero
Copy link
Contributor

sodero commented Jan 7, 2022

I would recommend using gcc 11 and clib2 btw. If you're using a native compiler you could pick these, gcc 11 and
clib2.

@MBeijer
Copy link
Author

MBeijer commented Jan 7, 2022 via email

@MBeijer
Copy link
Author

MBeijer commented Jan 7, 2022 via email

@capehill
Copy link

In case you were building with -std=c++11 (or later), try -std=gnu++11. In newlib, strcasecmp and some other functions are not available if STRICT_ANSI is defined.

I have seen similar problem when building MilkyTracker. First I tried -U__STRICT_ANSI__ which works around it, but gnu++11 is probably a cleaner solution.

@MBeijer
Copy link
Author

MBeijer commented Sep 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants