Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7167601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:36:32+00:00 2026-05-28T14:36:32+00:00

Im getting an error that is really frustrating me in my C program. the

  • 0

Im getting an error that is really frustrating me in my C program.

the error is:

main.c(65): error C2371: 'extractVals' : redefinition; different basic types

directClass is suppose to accept a reference to a char, specifically line 20 (in the switch case ‘g’) using variable s. Im not sure how they are not the same basic type, but im not very good with C, so im not great at identifying all issues. Any help would be great.

#include <gl\glew.h>
#include <gl\freeglut.h>
#include <gl\GLU.h>
#include <stdio.h>

void directFile(char input[100]){
    char switchVal [10] , *s = switchVal;
    float val1, val2, val3, val4;

    s = strtok(input, " \n\0");

    printf("Told str is %s\n", s);
    switch(*s){

        case '#':
            printf("%s is a comment. Has no bearing on application\n", s);
            break;
        case 'g':
            printf("%s is the command to translate an object!\n", s);
            extractVals(s);
            break;
        case 's':
            printf("%s is the command to scale, now which one is it?\n",s);
            break;
        case 'r':
            printf("%s will rotate the image!\n",s);
            break;
        case 'c':
            if(strcmp(s , "cone") == 0){
                printf("It appears you have your self a %s\n", s);
            } else if (strcmp(s , "cube") == 0){
                printf("%s is cool too\n" , s);
            } else if (*s == 'c'){
                printf("Welp command was \"%s\", lets change some colors huh?\n",s);
            }
            break;
        case 't':
            break;
        case 'o':
            break;
        case 'f':
            break;
        case 'm':
            break;
    }
}

void extractVals(char *input){
    while(input != NULL){
        printf("%s\n", input);
        input = strtok(NULL, " ,");
    }

}

void makeLower(char *input)
{
    while (*input != '\0')
    {
        *input = tolower(*input);
        input++;
    }
}


int main(int argc, char *argv[]) {
    FILE *file = fopen(argv[1], "r");
    char linebyline [50], *lineStr = linebyline;
    char test;

    glutInit(&argc, argv);

    while(!feof(file) && file != NULL){
        fgets(lineStr , 50, file);
        makeLower(lineStr);
        printf("%s",lineStr);

        directFile(lineStr);

    }
    fclose(file);


    glutMainLoop();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:36:33+00:00Added an answer on May 28, 2026 at 2:36 pm

    Your error is because you did not provide a prototype before calling extractVals(). When the compiler runs into such a case, it assumes that the function is declared like:

    int extractVals();
    

    Then later when it finds the definition, it conflicts with this assumption. This error can be fixed by adding an appropriate prototype, either before directFile() or in a header that you include:

    void extractVals(char *input);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a really frustrating error that I've been struggling with for some time
This is getting really frustrating now! I've created a script that appends some content
I am getting an error that says: error: looser throw specifier for 'virtual CPLAT::CP_Window::~CP_Window()'
I am trying to access a stored procedure and I'm getting an error that
I want to rename a database, but keep getting the error that 'couldn't get
Im getting this linker error that won't let me compile. It only happens on
I am getting this error now that I hit version number 1.256.0: Error 4
I'm getting the NRE error that says: Object reference not set to an instance
I'm getting a FormatException: Input string was not in a correct format error that
Hey. the busted website is: www.mgxvideo.com/mgxcopy-alpha-3 , and the specific error that I'm getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.