It works.
Thank you very much!
Hendrik Sattler wrote:
> Am Samstag 16 Januar 2010 19:21:42 schrieb Yixun Liu:
>
>> I do add test.c (see previous email).
>> If I change test.c to test.cxx, it works. I do not know why.
>>
>
> Hint: C++ name mangling.
>
> Add a test.h:
> extern "C" {
> void
Am Samstag 16 Januar 2010 19:21:42 schrieb Yixun Liu:
> I do add test.c (see previous email).
> If I change test.c to test.cxx, it works. I do not know why.
Hint: C++ name mangling.
Add a test.h:
extern "C" {
void func();
}
and include it in your main.cxx file.
Alternatively, set the LANGUAGE
I guess it would be a C linkage problem then.
Have you got extern "C" {} around the exported symbols?
Cheers,
Stephan
On Sat, Jan 16, 2010 at 7:21 PM, Yixun Liu wrote:
> I do add test.c (see previous email).
> If I change test.c to test.cxx, it works. I do not know why.
>
__
I do add test.c (see previous email).
If I change test.c to test.cxx, it works. I do not know why.
Hendrik Sattler wrote:
> Am Samstag 16 Januar 2010 15:40:55 schrieb Yixun Liu:
>
>> ADD_EXECUTABLE(main main.cxx )
>>
>> TARGET_LINK_LIBRARIES(main ITKCommon ITKIO vtkCommon vtkIO )
>>
>> It work
Am Samstag 16 Januar 2010 15:40:55 schrieb Yixun Liu:
> ADD_EXECUTABLE(main main.cxx )
>
> TARGET_LINK_LIBRARIES(main ITKCommon ITKIO vtkCommon vtkIO )
>
> It works well.
> Now I need to ,in main.cxx, invoke a function, let's say func(),
> defined in another c file, let's say test.c.
You need
Hello Liu,
> However, after ccmake and then make, I got the error:
> main.cxx:(.text+0x10a): undefined reference to `func()'
> collect2: ld returned 1 exit status
Can you put
SET (CMAKE_VERBOSE_MAKEFILE TRUE)
to your CMakeLists.txt to check what compiler command is run?
bye
C.M.
Hi,
I am not familiar with writing CMakelist.
I have a simple cmakelist file as following.
# This project is designed to be built outside the Insight source tree.
PROJECT(main)
# Find ITK.
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ENDIF(ITK_FOUND)
FIND_PACKAGE(VTK REQUI