Problem with compiling a multiple source files involve header file

This is a discussion on Problem with compiling a multiple source files involve header file within the C++ Programming forums, part of the General Programming Boards category; Hi guys, when i using g++ ver 4.3 to compile plenty source files, process is OK, no error or warning ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    5

    Problem with compiling a multiple source files involve header file

    Hi guys, when i using g++ ver 4.3 to compile plenty source files, process is OK, no error or warning occurs but it made a file name like <header_filename>.h.gch, for example i have hello.hh header file, it will be made hello.hh.gch. I try to open this file but it's a binary file. So what i need to solve this problem, i wonder myself this is a error? or what is this?.

    Thank you for any help provided.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,648
    It looks like you are using pre-compiled headers. Was that your intention?
    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

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    5
    yes, that's right, i used something like that in my header file:
    #ifndef header_h
    #define header_h

    // declare area

    #endif
    but when i using these instruction will be made file *.gch ?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,648
    Quote Originally Posted by meterpreter
    but when i using these instruction will be made file *.gch ?
    No, that is just a typical header inclusion guard.

    I suggest that you read the GCC documentation on pre-compiled headers. Since you did not create any files with the ".gch" extension yourself, my guess is that you used the -include compiler option unintentionally.

    If so, then a solution if you do not want to use pre-compiled headers is to delete all those ".gch" files and then avoid passing -include to gcc or g++.
    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
    Join Date
    Sep 2011
    Posts
    5
    That's perfect, problem is solved but..

    I have another question not relative with this topic. I've just sign in (yes, of course), then i click on setting on the top-right of this page, then i chose general setting, i changed theme forum form default to mobile theme (i don't remember exactly), so the question is "what is need to undo my act"?. sorry for this stupid.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,648
    You probably need to find the general settings for the forum in the mobile theme somehow then change forum skin to normal style.
    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

  7. #7
    Registered User PuKa's Avatar
    Join Date
    Oct 2011
    Posts
    23
    Access is denied when i try to click on "Profile". That's annoying, another way i registry a new account names puka . Th@nks for reply.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling multiple source codes
    By JonathanS in forum C Programming
    Replies: 6
    Last Post: 09-21-2011, 01:41 AM
  2. facing problem with multiple source file porgram.
    By learning"c" in forum C Programming
    Replies: 10
    Last Post: 05-15-2011, 12:08 PM
  3. compiling multiple source files
    By jtieu in forum C++ Programming
    Replies: 4
    Last Post: 03-29-2011, 06:51 PM
  4. compiling source files and header file at once?
    By 1jackjack in forum C Programming
    Replies: 10
    Last Post: 05-04-2007, 11:06 AM
  5. Replies: 1
    Last Post: 05-01-2003, 02:52 PM

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