Error C2371 redefinition; different basic types

Error C2371 redefinition; different basic types

redefinition; different basic types struct
error c2371: 'int8_t' : redefinition; different basic types
error c2371 'size_t': redefinition; different basic types
error c2371 ssize_t redefinition; different basic types
redefinition different basic types forward declaration
redefinition; different basic types cpp
boolean redefinition; different basic types
c struct redefinition different basic types

The problem you have is that you are trying to call your functions before you have defined (or at least, declared) them. In the C language, when the compiler encounters a call to such an "undeclared" function, it assumes that it is of a type that returns int (it can normally work out what any argument types will be from the actual values given).

So when, in your main function, the compiler comes across Ex1(), it assumes that the function returns an int (even though this isn't actually used). Then, later, when you have your definition for void Ex1(), the compiler has encountered a conflicting (re-)definition - with a different return type.

To fix this, the simplest option is to put a "forward declaration" of any functions used (both Ex1 and function1) before any code that calls them. In your case, this would be:

#include <stdio.h> // This "system header" provides the declarations for "printf" and "scanf"
void Ex1(); // No definition here - just telling the compiler what form it takes.
int function1(int sum); // And the same here
int main()
{
    Ex1();
}
// .. . the rest of your code follows

Feel free to ask for further clarification and/or explanation.

Compiler Error C2371, redefinition; different basic types. The identifier is already declared. The following sample generates C2371: C++. Copy. // C2371.cpp int� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.


You have problem with passing arguments between two functions EX1 and function 1. function1 should have num1, num2 and num3 as arguments.

int main()
    {
        Ex1();
    }
    void Ex1()
    {
        int num1, num2, num3,min;
        printf("enter three diff numbers  \n");
        scanf("%d %d %d", &num1, &num2, &num3);
        printf("%d", function1(num1, num2, num3));
    }

    int function1(int num1, int num2, int num3)
    {
        int min, max;
        if (num1 > num2)
        {
            max = num1;
            min = num2;
        }
        else
        {
            max = num2; min = num1; 
        }
        if (num3 > max)
        {
            min = max;
            max = num3;
        }
        if (num3 > min&& num3 < max)
        {
            min = num3;
        }
        return min;
}

how to fix Error C2371 redefinition; different basic types, Because of the speed its really hard to hear what youre saying. Read more. Show less. Reply 3 4 Duration: 0:36 Posted: Apr 21, 2018 You are trying to call eb and ec before they are declared or defined. Move the definition of ec before eb and both before exera.You could also forward declare your functions before you define any of them like so:


This is just the order of definition, try to do it like this:

int num1, num2, num3, min, max;

int function1(int sum)
{

    if (num1 > num2)
    {
        max = num1;
        min = num2;
    }
    else
    {
        max = num2; min = num1; 
    }
    if (num3 > max)
    {
        min = max;
        max = num3;
    }
    if (num3 > min&& num3 < max)
    {
        min = num3;
    }
    return min;

}

void Ex1()
{
    int num1, num2, num3;
    printf("enter three diff numbers  \n");
    scanf("%d %d %d", &num1, &num2, &num3);
    printf("%d", function1(min));
}

int main()
{
    Ex1();
}

Error C2371: redefinition; different basic types � Issue #140 � stan , Error C2371: redefinition; different basic types #140. Closed. flimao opened this issue on Jan 27, 2015 � 18 comments. Closed� This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more


eabase.h: error C2371: 'char16_t' : redefinition; different basic types , eabase.h: error C2371: 'char16_t' : redefinition; different basic types #12. Closed. Ono-Sendai opened this issue on Feb 10, 2016 � 15 comments. Closed� Re: Visual Studio error C2371 redefinition; different basic types and C2040 A very common cause of this problem is "multiple inclusion" of header files. Check that each header file has some kind of guard that prevents it from being included multiple times - e.g.


[RESOLVED] Visual Studio error C2371 redefinition; different basic , Re: Visual Studio error C2371 redefinition; different basic types and C2040. A very common cause of this problem is "multiple inclusion" of header files. Check that each header file has some kind of guard that prevents it from being included multiple times - e.g. KarnstenK sort of gives you the correct answer but it needs expanding There are two units both trying to define "int8_t" and one of those is part of the standard C library it will be in "StdInt.H" in the system include directory of any C99 compliant compiler.


error C2371 : redefinition; different basic types, error C2371 : redefinition; different basic types. Hi im writing a program for a user calender operation i keep getting dis error and i cant figure� Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear.