User forums > Using Code::Blocks

Opening a project ignores duplicated linker options

(1/1)

Mr_KoKa:
When opening a project with target like this (please notice duplicated -lcrypto and -lssl)


--- Code: ---<Target title="Release">
<Option output="bin/Release/Project" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="msys2_mingw32" />
<Compiler>
<Add option="-O2" />
<Add option="-Wextra" />
<Add option="-std=c++11" />
<Add option="-Wno-unused-parameter" />
<Add option="-DCURL_STATICLIB" />
<Add directory="C:/curl-7.88.1/include" />
<Add directory="include" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-static" />
<Add option="c:\curl-7.88.1\lib\.libs\libcurl.a" />
<Add option="-DCURL_STATICLIB" />
<Add option="-lgdiplus" />
<Add option="-lcomctl32" />
<Add option="-lgdi32" />
<Add option="-lbcrypt" />
<Add option="-lcrypto" />
<Add option="-lssl" />
<Add option="-lcrypto" />
<Add option="-lssl" />
<Add option="-lzstd" />
<Add option="-lz" />
<Add option="-lwldap32" />
<Add option="-lcrypt32" />
<Add option="-lws2_32" />
</Linker>
</Target>

--- End code ---

Result is:



So the duplicated linked options are ignored. Project does not compile without them.

Name             : Code::Blocks
Version          : 20.03-r11983
SDK Version      : 2.0.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxMSW port)
Version 3.1.3 (Unicode: wchar_t, debug level: 1),
compiled at Nov  1 2019 18:53:26

Runtime version of toolkit used is 10.0.

stahta01:
I would suggest putting the libraries in the link library list and see if that works.

Tim S.

Mr_KoKa:
It does not work either. After opening project with target linker section as such:

--- Code: ---<Linker>
<Add option="-s" />
<Add option="-static" />
<Add library="c:/curl-7.88.1/lib/.libs/libcurl.a" />
<Add library="libgdiplus.a" />
<Add library="libcomctl32.a" />
<Add library="libgdi32.a" />
<Add library="libbcrypt.a" />
<Add library="libcrypto.a" />
<Add library="libssl.a" />
<Add library="libzstd.a" />
<Add library="libz.a" />
<Add library="libwldap32.a" />
<Add library="libcrypt32.a" />
<Add library="libws2_32.a" />
<Add library="libcrypto.a" />
<Add library="libssl.a" />
<Add directory="C:/msys64/mingw32/lib" />
</Linker>

--- End code ---
Result is:


It works until restart.

But as I wrote this post I thought about solution to mklink these 2 libraries I need duplicated to different location and add them full path second time and it works, does not remove as duplicate.

The linker section look now like this:

--- Code: ---<Linker>
<Add option="-s" />
<Add option="-static" />
<Add library="c:/curl-7.88.1/lib/.libs/libcurl.a" />
<Add library="libgdiplus.a" />
<Add library="libmsimg32.a" />
<Add library="libbcrypt.a" />
<Add library="libcrypto.a" />
<Add library="libssl.a" />
<Add library="C:/libdup/libcrypto.a" />
<Add library="C:/libdup/libssl.a" />
<Add library="libzstd.a" />
<Add library="libz.a" />
<Add library="libwldap32.a" />
<Add library="libcrypt32.a" />
<Add library="libws2_32.a" />
<Add directory="C:/msys64/mingw32/lib" />
</Linker>

--- End code ---

BTW when adding library path to linker search path and entering them by filename without full path they become linker options instead in build log, only libraries added by full path appear as files in build log, so maybe adding them all as full path would work, or maybe it would still be seen as duplicate and would be removed.

--- Code: ----s -static  -lgdi32 -luser32 -lkernel32 -lcomctl32 c:\curl-7.88.1\lib\.libs\libcurl.a -lgdiplus -lmsimg32 -lbcrypt -lcrypto -lssl C:\libdup\libcrypto.a C:\libdup\libssl.a -lzstd -lz -lwldap32 -lcrypt32 -lws2_32 -mwindows

--- End code ---

Thanks for the idea for the workaround :]

stahta01:
Example: gdiplus should be added to linker library list if you wish to link to shared gdiplus.
If you wish to link to static library then use full library paths work for me.

Edit: IIRC, using "libgdiplus.a" tells the compiler to link to static version of gdiplus for some Compilers.

Tim S.

Navigation

[0] Message Index

Go to full version