Thread: Precompiled header syntax error.

  1. #1
    Registered User
    Join Date
    Dec 2009

    Precompiled header syntax error.

    Hi, I'm programming a small Pinball game using codeblocks and SDL library. I have 6 sources and 7 headers, both in separate folders inside the project. 'main' is inside the project folder, separate from both '.cpp' and '.h'. In the headers build options I have them to be compiled and linked. When I build the project from scratch, it starts precompiling headers and then linking the sources, but in the end it throws the following error:

    /usr/bin/ld:include/GUI.h.gch |1| syntax error|

    ||=== Build finished: 1 errors, 0 warnings (0 minutes, 28 seconds) ===|

    When I used the #include directive, I had to use something like this:
    #include "../include/somefile.h"

    I can't find what am I doing wrong, so any help is greatly appreciated!

    Thanks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > /usr/bin/ld:include/GUI.h.gch |1| syntax error|
    ld is the linker, which combines object (.o / .obj) files with libraries (.lib, .dll) to produce the executable.

    I've no idea what a gch file is - though from what you said, it seems like the precompiled header for GUI.h.
    In any event, you should not be trying to link with it, or even include it directly in your source code.

    Check your linker settings.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  3. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 09:09 PM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM