Thread: header files

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    35

    header files

    I keep getting an error while compiling saying it can't find my defs.h file. In my main .cpp, I declare it like

    #include "defs.h"

    and this is my defs.h:

    #ifndef _DEFS_H
    #define _DEFS_H

    extern int rdesc[2];
    extern int rnum;
    extern int SetRoom();
    extern int DispRoom(int);

    #endif

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Is defs.h in the same directory as the .cpp file which includes it?

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    35
    Got that working, but now I get this:

    C:\TextGame\Game\engine.cpp(14) : warning C4551: function call missing argument list
    Linking...
    rooms.obj : error LNK2001: unresolved external symbol "int * rdesc" (?rdesc@@3PAHA)
    Debug/Game.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Game.exe - 2 error(s), 1 warning(s)

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > warning C4551: function call missing argument list
    Well look at your code, and the prototype, then figure out which is correct

    > unresolved external symbol "int * rdesc" (?rdesc@@3PAHA
    Put

    int rdesc[2];
    In one of your .cpp files

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