Thread: Help using Header Files

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    4
    Ok I have tried doing as you said, and I'm sorry if this is something really small that I'm doing wrong but I just cant see the problem so hopefully you can help me with this. Thnx in advance!

    My "robotusage.c" looks like this:
    Code:
    #include "robotusage.h"
    
    int incrementI(int num, int dir)
    {
     if (dir == 1)
      return num += 4;
     else return num -= 4;
    }
    My robotusage.h looks like this:
    Code:
    #include <stdlib.h>
    #include <stdio.h>
    #include <GLUT/glut.h>
    
    int incrementI(int num, int dir)
    The part of the main.c that is using this code is:
    Code:
    player.pointX = incrementI(player.pointX, 1);
    And it gives me an "error:syntax error before "{" token" in the robotusage.c file. I cant seem to find what I've done wrong.

    I would post all of the main.c as well but its quite big until I can sort this stuff out. Thnx again!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Quote Originally Posted by d34n View Post
    My robotusage.h looks like this:
    Code:
    #include <stdlib.h>
    #include <stdio.h>
    #include <GLUT/glut.h>
    
    int incrementI(int num, int dir)
    Put a semicolon at the end of that last line.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. #include header files or .cpp files?
    By DoctorX in forum C++ Programming
    Replies: 3
    Last Post: 12-23-2006, 12:21 PM
  3. classes and header files
    By Drake in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2006, 07:12 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM