News:

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

Main Menu

C++ project can not call C static library functions

Started by amit1947, December 04, 2008, 08:23:22 PM

Previous topic - Next topic

amit1947

Hi everyone, I'm just getting started with Code::Blocks but I have some issues. I created a static library with C (.a extension) and I want to call these functions within another C++ project. When I try to build the C++ project I get an error in the Build Log : "undefined reference to 'HwOpen()' ". HwOpen() is a function in the static library.

I went into the C++ Project's build options and selected the correct lib.a file in the "Linker Settings" tab.

I know this process worked when I called the static library functions from a C project, but I think I need to do something else for the C++ project.

Thanks for any help!

amit1947

I forgot to mention that I'm using Code::Blocks in Ubuntu Linux.

dje


amit1947

Thanks for the help! That did it , I added

extern "C"{

function_prototypes();

}

to the C lib's header file and it works now.