User forums > Using Code::Blocks

Disabling PCH for a single file

(1/2) > >>

If the whole project is using pch, but a single file doesn't...
Is there a way to disable it for this file only?
Or do I have to remove the project-wide pch usage
and insert it for all but the one file?
Thanks in advance.

That problem arises when inserting sqlite amalgamation (C) into
an wxWidget project (C++).
The latter has project wide PCH usage and this doesn't work for
the sqlite code.
I meanwhile tried to disable PCH usage in the advanced properties
of sqlite.c, adding  -DNOPCH to

--- Code: ---$compiler $options $includes -c $file -o $object
--- End code ---
But no effect, it still uses pch.
The command line is like this

--- Code: ---gcc.exe  -DNOPCH -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -ID:\develop\wxWidgets\include -ID:\develop\wxWidgets\lib\gcc_dll\mswu -c D:\develop\sqlite-amalgamation-3310100\sqlite3.c -o obj\Debug\sqlite-amalgamation-3310100\sqlite3.o
--- End code ---

I don't think so. You have to probably put the sqlite code in a static library and build it separately.

Thanks.  :)

I meanwhile tried that way.

Originally I thought taking the amalgamation would be the simplest way of using sqlite.
But taking the precompiled dll + headers from amalgamation is even easier.
As long as your compiler matches with the one used for the precompiled dll.
You don't even need the def file.

Do you understand the idea of CB targets?
If not, I suggest you learn how to have multiple targets in a project.
You can set different compiler and linker options for each target.

I would create an static library target for the sqlite file.

Tim S.


[0] Message Index

[#] Next page

Go to full version