User forums > Using Code::Blocks

Mixing C and C++ code linker option

(1/1)

stefanofranzoni:
My project contains C code and uses an external library written in C++.
The linker is normally g++ but on an Ubuntu 20.04 installation he automatic linker choice is gcc and it generates many errors.
I don't find an option to force the linker to g++ while keeping the compiler to gcc.

Thanks in advance
Stefano Franzoni

stahta01:
CB Version info is needed; the option below is less than 3 years old IIRC.

CB Version SVN 12452

Project -> Build Options
Tab: Linker Settings
Linker Executable: "Auto Detect" likely needs changed to "Use C++ Compiler"

Tim S.

stefanofranzoni:
Tim, thanks for your reply.

My version of Codeblocks is 20.03.

Your suggestion solves my problem.

I noticed however that it is not necessary to add "Use C ++ compiler" in the linker options when using Codeblocks as administrator ie running "sudo Codeblocks".

The problem is reproducible with two simple files, one in C and the other in C ++.

Stefano

Navigation

[0] Message Index

Go to full version