The declarations in my_c_header.h are surrounded by

#if defined(__cplusplus)
    extern  "C" {
#endif
// functions and stuff declarations
#if defined(__cplusplus)
    }
#endif

So i'm not sure about whether it's taken into account or not, and how to
have CMake take it into account when I compile my library as C.

Maxime Lecourt


2011/6/1 Hendrik Sattler <p...@hendrik-sattler.de>

> Zitat von Maxime Lecourt <maxime.leco...@gmail.com>:
>
>  I'm having what is probably a newbie problem, but a problem to me.
>>
>> I have C source files in two different directories, that I use to build a
>> dll, that is loaded by another C++ project.
>>
>> I tried to build C objects and link with C++
>> set_target_properties(ppc PROPERTIES LINK_FLAGS "-Wl,--kill-at"
>> LINKER_LANGUAGE "CXX")
>> but I have linker problem (undefined references) when trying to link my
>> C++
>> project.
>>
>> So I decided to build my library as C++ and not C.
>>
>
> Known problem but wrong decision. If your library is C, then compile it as
> C, not as C++. Your real problem is that you probably forgot the
> extern "C" {
> #include "my_c_header.h"
> }
> lines for inclusion of the C header files.
>
> HS
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to