yes, I think for some reasons it has difficulty linking with the function (correct set of parameters), i.e, it has difficulty figuring out which one of the functions to use,
Leila From: [email protected] Sent: Thu, 6/23/2011 3:01pm To: Leila Baghdadi <[email protected]> ; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake Hope it helps. I’m not completely clear on what you are talking about with the overloading. Are you saying you have the same function defined in multiple static libraries? Aaron C. Meadows From: Leila Baghdadi [mailto:[email protected]] Sent: Thursday, June 23, 2011 1:55 PM To: Meadows, Aaron C.; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake Thanks very much aaron for your suggestions, I will do some further investigation and report if I find something, I was just kind of wondering if there was something about libraries and overloading that I was not aware of, Leila From: [email protected] Sent: Thu, 6/23/2011 2:52pm To: Leila Baghdadi <[email protected]> ; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake Oh, sorry.. I missunderstood about the line 76. =D Ok, looking at your CMakeLists.txt, I see the ADD_SUBDIRECTORY(libctsim). I’m assuming there is a CMakeLists.txt in there which does the ADD_LIBRARY. The ADD_SUBDIRECTORY() calls are before you’re doing a bunch of ADD_DEFINITIONS(). The definitions you are setting up below are not going to apply to those subdirectories. Is it possible that the signature of the function is different in the library than in the opt_ctsim executable because of these definitions? On windows, I would suggest using ‘dumpbin.exe /LinkerMember’ to see the mangled signature of the functions in the library and compare them to the expected signature printed in the linker error for the executable (here’s a description I wrote about it: http://stackoverflow.com/questions/261377/lnk2001-error-when-compiling-apps-referencing-stlport-5-1-4-with-vc-2008/687185#687185 ) I’m not sure what the equivolent process would be for gcc if that is what you are using. Looks like it might be the programs ‘nm’ and ‘objdump’. You might try moving your ADD_SUBDIRECTORY() calls to right above ADD_EXECUTABLE and see if that allows the linking to work correctly. Aaron C. Meadows From: Leila Baghdadi [mailto:[email protected]] Sent: Thursday, June 23, 2011 1:33 PM To: Meadows, Aaron C.; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake yep that's how its defined. (note, this is not my code, it is backprojection code free for download at ctsim.org) typedef double kfloat64; typedef kfloat64** const ImageFileArrayConst; the code has diversions between 32 and 64 bit, anyways, that's how it is defined. Leila From: [email protected] Sent: Thu, 6/23/2011 2:09pm To: Leila Baghdadi <[email protected]> ; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake Unless “ImageFileArrayConst” is a typedef for “double **”, there is not an ImageFile::statistics() function which takes a double** as the first parameter. (Line 288 and 296 have the two versions of ImageFile::statistics()) If you look in views.cpp at the function ImageFileView::OnProperties() function where it is calling the ImageFile::statistics() function, what is the type of the first parameter? Do you have an extra & on the front of a double* variable there? Aaron C. Meadows From: Leila Baghdadi [mailto:[email protected]] Sent: Thursday, June 23, 2011 12:56 PM To: Meadows, Aaron C.; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake Hello I have attached the CMakeLists.txt file (note, I commented the source in question line 76) and I get the following error, If I leave line 76 in, I get a clean build Linking CXX executable opt_ctsim CMakeFiles/opt_ctsim.dir/src/views.cpp.o: In function `ImageFileView::OnProperties(wxCommandEvent&)': views.cpp:(.text+0x1bfd9): undefined reference to `ImageFile::statistics(double**, double&, double&, double&, double&, double&, double&) const' views.cpp:(.text+0x1c57a): undefined reference to `ImageFile::statistics(double**, double&, double&, double&, double&, double&, double&) const' collect2: ld returned 1 exit status I am also attaching the source imagefile.cpp located in libctsim subdirectory. thanks From: [email protected] Sent: Thu, 6/23/2011 11:29am To: Leila Baghdadi <[email protected]> ; [email protected] Subject: RE: [CMake] regarding linking functionality and overloading in cmake This sounds like poorly formed c++, not a CMake issue. Can you include your CMakeLists.txt, a copy of the error, and possibly a simple example which shows the problem? Aaron C. Meadows From: [email protected] [mailto:[email protected]] On Behalf Of Leila Baghdadi Sent: Wednesday, June 22, 2011 3:57 PM To: [email protected] Subject: [CMake] regarding linking functionality and overloading in cmake hi everyone, I have been trying to use cmake to build ctsim(need to add my own code to it later) and finally managed to do it however I have difficulty understanding why my puny solution works! I have 3 different directories (a,b,c) in ctsim , so I set up cmake files in each one and built liba.so and so on, now I am trying to build the executable cstim by linking to the above three libraries and I kept getting an error, regarding an overloading function in directory a, I thought that using TARGET_LINK_LIBRARIES(target a b c) would address that but instead I had to add the source code with the overloading function from directory a into the list of source codes for the ctsim executable, does that make sense? any thought thanks Leila
_______________________________________________ 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
