News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Using Clang (7.0) on Windows to Build Code::Blocks for Windows

Started by dkaip, November 20, 2018, 02:25:44 PM

Previous topic - Next topic

dkaip

Hello. I have build pdfium library(pdfium.lib about 2MB) in Windows 10.
I am trying to compile and link a simple command prompt C::B project 
#include "fpdfview.h"
int main()
{
    FPDF_STRING test_doc = "test_doc.pdf";
    FPDF_DOCUMENT doc = FPDF_LoadDocument(test_doc, NULL);
    return 0;
}


As i see building with ninja, the line has clang compiler, and not clang++.exe but clang-cl.exe.
My question is how to put all those thinks to set compiler and linker with write way?
Thank you
Jim.

Quoteninja: Entering directory `out\1'
[1/1192] ../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes  "-imsvc..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-imsvc..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-imsvc..\..\..\..\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\cppwinrt" -DV8_DEPRECATION_WARNINGS -DUSE_AURA=1 -DNO_TCMALLOC -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED "-DCR_CLANG_REVISION=\"346388-1\"" -D_HAS_EXCEPTIONS=0 -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=1 -DWIN32 -D_SECURE_ATL -D_USING_V110_SDK71_ -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=0x0A000002 -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DGTEST_API_= -DGTEST_HAS_POSIX_RE=0 -DGTEST_LANG_CXX11=1 -DGTEST_HAS_TR1_TUPLE=0 -I../../third_party/googletest/src/googletest -I../.. -Igen -I../../third_party/googletest/src/googletest/include /utf-8 /X -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -fcolor-diagnostics -fmerge-all-constants -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -fcomplete-member-pointers /Gy /FS /bigobj /d2FastFail /Zc:sizedDealloc- -fmsc-version=1911 -m64 /Brepro /O1 /Ob2 /Oy- /Zc:inline /Gw /Oi /Z7 -fno-standalone-debug /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare /W3 /wd4800 /wd4267 /wd4996 -Wno-unused-variable /WX /wd4091 /wd4127 /wd4251 /wd4275 /wd4312 /wd4324 /wd4351 /wd4355 /wd4503 /wd4589 /wd4611 /wd4100 /wd4121 /wd4244 /wd4505 /wd4510 /wd4512 /wd4610 /wd4838 /wd4995 /wd4996 /wd4456 /wd4457 /wd4458 /wd4459 /wd4200 /wd4201 /wd4204 /wd4221 /wd4245 /wd4267 /wd4305 /wd4389 /wd4702 /wd4701 /wd4703 /wd4661 /wd4706 /wd4715 /wd4702 -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-null-pointer-arithmetic -Wno-nonportable-include-path -Wno-ignored-pragma-optimize -Wno-defaulted-function-deleted /wd4800 /TP /GR- /wd4577 /c ../../third_party/googletest/src/googletest/src/gtest-printers.cc /Foobj/third_party/googletest/gtest/gtest-printers.obj /Fd"obj/third_party/googletest/gtest_cc.pdb"

stahta01

I suggest not using a "Subject" that has little to do with your question as a way to get faster help!

I have no idea on how to use "clang-cl.exe" inside Code::Blocks.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Frank_CB

Take a look at llvm.org.  Don't believe CB supports Clang, nor many other compilers.

oBFusCATed

Quote from: Frank_CB on December 01, 2018, 06:11:03 PM
Take a look at llvm.org.  Don't believe CB supports Clang, nor many other compilers.
Can you prove this statement? C::B supports many different compilers... And I'm sure it could be configured to work with the Visual studio compatible clang driver.

@dkaip: I'd start with a visual studio based compiler and I'd replace the toolchain path and the executable names. Also I'd use cmd.exe window to see what commands I need to execute then I'll compare them against what C::B is producing in the build log.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ollydbg

Quote from: stahta01 on November 20, 2018, 05:57:55 PM
I suggest not using a "Subject" that has little to do with your question as a way to get faster help!
Tim S.

I totally agree with Tim.

Using clang compiler inside C::B should not be that hard.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.