User forums > Using Code::Blocks

Codebocks on windows link 1561 error using clang

(1/2) > >>

pabristow:
I am trying to use Codebocks 17.12 on Windows 10 (uptodate) with Visual Studio 15.6.1 installed linking to the Boost test library.

I can build and run use of Boost.Test (using a library) using GCC 7.1 (so I am confident that the C++ is correct, and the gcc boost.test library file must be correct).

With Clang 5.0.0 (or the shiny new 6.0.0) I can compile and run programs that do not try to *link* to any Boost libraries.

I hve these extra compiler includes
C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include

When I try an example of using Boost.Test library, it compiles OK

but fails to link 1561 error using Clang 5 (or the shiny new 6).
(This is said to mean is lacking a main() which is provided by the Boost.test program).

Is this expected? Target: x86_64-pc-windows-msvc

(On gcc 7.2.0 --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 )

Anybody with (good) experience of using Clang on Codeblocks on Windows with suggestions?

Thanks

Paul

PS Complete failing message is

-------------- Build: clang500_Release in hello_boost_test (compiler: LLVM Clang 5.0.0 Compiler)---------------

clang++.exe  -o bin\Release\hello_test.exe obj\Release\hellos\hello_boost_test\hello_boost_test.o  -m64 -v  I:\modular-boost\lib\libboost_unit_test_framework-clang50-mt-x64-1_66.lib
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\LLVM\clang-500\LLVM\bin
 "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX64\\x64\\link.exe" "-out:bin\\Release\\hello_test.exe" -defaultlib:libcmt "-libpath:C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.13.26128\\lib\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\ucrt\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\um\\x64" -nologo "obj\\Release\\hellos\\hello_boost_test\\hello_boost_test.o" "I:\\modular-boost\\lib\\libboost_unit_test_framework-clang50-mt-x64-1_66.lib"
clang++.exe: error: linker command failed with exit code 1561 (use -v to see invocation)
LINK : fatal error LNK1561: entry point must be defined



BlueHazzard:
a full rebuild log would be a beginning... This is only a partial log.

pabristow:

-------------- Clean: clang500_Release in hello_boost_test (compiler: LLVM Clang 5.0.0 Compiler)---------------

Cleaned "hello_boost_test - clang500_Release"

-------------- Build: clang500_Release in hello_boost_test (compiler: LLVM Clang 5.0.0 Compiler)---------------

clang++.exe -Wall -fexceptions -m64 -v -fms-extensions -Wall -fms-compatibility-version=19.10 -II:\modular-boost -II:\modular-boost -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" -c J:\Cpp\hellos\hello_boost_test\hello_boost_test.cpp -o obj\Release\hellos\hello_boost_test\hello_boost_test.o
clang++.exe  -o bin\Release\hello_test.exe obj\Release\hellos\hello_boost_test\hello_boost_test.o  -m64 -v  I:\modular-boost\lib\libboost_unit_test_framework-clang50-mt-x64-1_66.lib
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\LLVM\clang-500\LLVM\bin
 "C:\\LLVM\\clang-500\\LLVM\\bin\\clang++.exe" -cc1 -triple x86_64-pc-windows-msvc19.10.0 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello_boost_test.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file "J:\\Cpp\\hello_test\\obj\\Release\\hellos\\hello_boost_test\\hello_boost_test.gcno" -resource-dir "C:\\LLVM\\clang-500\\LLVM\\lib\\clang\\5.0.0" -I "I:\\modular-boost" -I "I:\\modular-boost" -I "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.16299.0" -I "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include" -internal-isystem "C:\\LLVM\\clang-500\\LLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\ucrt" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\shared" -internal-isystem "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.10586.0\\um" -Wall -Wall -fdeprecated-macro -fdebug-compilation-dir "J:\\Cpp\\hello_test" -ferror-limit 19 -fmessage-length 0 -fms-extensions -fms-compatibility -fms-compatibility-version=19.10 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o "obj\\Release\\hellos\\hello_boost_test\\hello_boost_test.o" -x c++ "J:\\Cpp\\hellos\\hello_boost_test\\hello_boost_test.cpp"
clang -cc1 version 5.0.0 based upon LLVM 5.0.0 default target x86_64-pc-windows-msvc
ignoring duplicate directory "I:\modular-boost"
ignoring duplicate directory "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 I:\modular-boost
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0
 C:\LLVM\clang-500\LLVM\lib\clang\5.0.0\include
 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um
End of search list.
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\LLVM\clang-500\LLVM\bin
 "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX64\\x64\\link.exe" "-out:bin\\Release\\hello_test.exe" -defaultlib:libcmt "-libpath:C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.13.26128\\lib\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\ucrt\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\um\\x64" -nologo "obj\\Release\\hellos\\hello_boost_test\\hello_boost_test.o" "I:\\modular-boost\\lib\\libboost_unit_test_framework-clang50-mt-x64-1_66.lib"
clang++.exe: error: linker command failed with exit code 1561 (use -v to see invocation)
LINK : fatal error LNK1561: entry point must be defined
Process terminated with status 1561 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
 
Dos this help shed any light on what I am doing wrong?

BlueHazzard:
i am honestly a bit confused. I have never done anything with clang... And this error message looks like a msvc error message. Is clang using msvc error messages?

After some googeling this seems to be a problem between console and gui application. What is the signature of your main function?


Some general tip:  by default you can not link libraries between compilers. So if you have compiled boost with gcc you can not use it with clang or msvc. It is even not possible to link between different gcc versions.

stahta01:
Google says "You haven't defined a function named main or wmain or WinMain or  wWinMain."

Edit: I just re-read you first post which stated about what I said above. In using the SDL library you must use just the correct main function signature for it to work; the same thing might be needed here.

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version