We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
Turn on listing files, so you get *.txt files in the output directory. At the top of each *.txt file, you will see a list of compiler options used for compiling that source file.
Is there any difference between compiling the source files in the library and the source files using the library?
Per, Your forum name is prepended by 2 'c' characters :-)
@cc: Thanks for your quick response I will try that as soon as I am back in the office today!
A common problem with this forum. The web form has the "First Name" field selected when you try to reply. Then you'll have to wait for a later post to try to remember to fix it.
Hi Per, I tried to get a clue out of the list files but can't say there are differences.
Actually I think that I do something wrong when creating the pch file.
How would you configure a project for using pch files?
Thanks a lot in advance and best regards. Jan
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