#include makes problems

This is a discussion on #include makes problems within the C++ Programming forums, part of the General Programming Boards category; hi! #include just replaces the text within the include file with the line "#include..." but it seems like that when ...

  1. #1
    Registered User Devils Child's Avatar
    Join Date
    Jan 2008
    Posts
    244

    #include makes problems

    hi!

    #include just replaces the text within the include file with the line "#include..."
    but it seems like that when i use a command within that include file which takes use of a library, it sais "command not found" or somethin...

    when i manually replace the line with the #include command with that function, everything works well.

    any reasonable explanation?
    thanks

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    #include "filename.h" essentially replaces that line with the contents of filename.h - slightly different that what you wrote. Of course, filename.h needs to exist, and the compiler must be able to find it.

    Forgive me if English is not your first language, but I really can't determine what exactly your problem is. Reword your original request, or perhaps provide code, along with how you compile/link that code, that demonstrates your problem.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User Devils Child's Avatar
    Join Date
    Jan 2008
    Posts
    244
    i am including cpp files instead of h (header) files... could that be the reason for this?

    anyway: when i replace the include line with the code thats in that include file, it works well. and thats what bothers me

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,589
    i am including cpp files instead of h (header) files... could that be the reason for this?
    Maybe. I do not think compilers actually care about the file extension of header files, but it might interfere with how an IDE builds your program and such. Generally, just choose between .h and .hpp for header files, and stick with it across your project.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User Devils Child's Avatar
    Join Date
    Jan 2008
    Posts
    244
    yes. it now seems to me like it works perfect when i use the *.h header file extension.
    everything fine now!
    thanks dudes

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with include?
    By c9dw2rm8 in forum C Programming
    Replies: 3
    Last Post: 02-21-2008, 12:29 PM
  2. some problems with #include
    By Cmaniac in forum C Programming
    Replies: 6
    Last Post: 04-15-2007, 11:28 PM
  3. more include file problems
    By whackaxe in forum C++ Programming
    Replies: 1
    Last Post: 04-19-2004, 07:09 AM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 02:23 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21