This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Precompiled header files

Hello forum,
I want to take use of precompiled header files in my project. My project is split into two parts. A library part and an application part.

The application part is using the library part by including a single header file called library.hpp. library.hpp contains a ton of includes.

I want to create a pch file out of library.hpp and force the ARM compiler to use that instead of recompiling each header file over and over again.
My problem is that I don't get uVision3 configured in a way that this pch file is properly created.

Here is what I did so far:
- create a cpp file called library.cpp
- configured the library.cpp C/C++ options with --create_pch=library.pch
- configured the overall project C/C++ options with --use_pch=library.pch

When I compile the project the library.pch is created but for each cpp file that is processed the compiler outputs a warning that the pch file has been created with compiler options different from current options.

Please can you give me a hint what I am doing wrong or direct me to any tutorials, sample projects?
I am using Cortex-M3 on ARM-MDK4.0 with uVision 3.9
Thanks a lot in advance and best regards
Jan

Parents
  • Hi again,
    here's a short update of what I did so far:

    I have three files:
    main.cpp
    stdafx.cpp
    stdafx.hpp

    In C/C++ options I added a "Misc Control" to main.cpp: --use_pch=stdafx.pch

    In C/C++ options I added a "Misc Control" to stdafx.cpp:
    --create_pch=stdafx.pch

    my main.cpp looks like this:

    #include "stdafx.hpp"
    int main(void)
    { }

    my stdafx.cpp looks like this:
    #include "stdafx.hpp"

    my stdafx.hpp looks like this:
    #include "..."
    #include "..."
    // ... tons of includes

    When I build my mini project I am getting the following warning:
    main.cpp: Warning: #629-D: the command line options do not match those used when precompiled header file "stdafx.pch" was created

    I really don't know how to get this pch thing working with Keil!

    Please can anyone help me and direct me how to set these things up correctly?
    Thanks a lot in advance!
    Jan

Reply
  • Hi again,
    here's a short update of what I did so far:

    I have three files:
    main.cpp
    stdafx.cpp
    stdafx.hpp

    In C/C++ options I added a "Misc Control" to main.cpp: --use_pch=stdafx.pch

    In C/C++ options I added a "Misc Control" to stdafx.cpp:
    --create_pch=stdafx.pch

    my main.cpp looks like this:

    #include "stdafx.hpp"
    int main(void)
    { }

    my stdafx.cpp looks like this:
    #include "stdafx.hpp"

    my stdafx.hpp looks like this:
    #include "..."
    #include "..."
    // ... tons of includes

    When I build my mini project I am getting the following warning:
    main.cpp: Warning: #629-D: the command line options do not match those used when precompiled header file "stdafx.pch" was created

    I really don't know how to get this pch thing working with Keil!

    Please can anyone help me and direct me how to set these things up correctly?
    Thanks a lot in advance!
    Jan

Children
No data