Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
Thanks Micha, The head developer managed to get it to compile under clion on the weekend, I suspect he may have cleaned up his source code a little bit. I also suspect listing the source code and targeted libraries in the correct order may have helped. Thanks for all your help! Best Sean On Mon, Jul 10, 2017 at 3:22 PM, Micha Hergardenwrote: > On 07-07-17 05:14, Sean Wayland wrote: >> Hi Micha, >> Thanks very much for the email. That seemed to make a small >> difference! With both those lines commented out these errors are >> generated ( below my email ) . >> I still have included >> project(CATSMAT) >> at the top line of the cmake file in the catsmat directory >> >> I tried commenting out each of those language type definitions >> separately but it didn't seem to help. >> The code compiles under xcode. Those language types ( C++14) are >> specified in Xcode so I was trying to find a way to copy what is in >> xcode. >> >> Is there a maximum number of "errors" before the clion compiler will >> spit the dummy ? >> >> Another executable will compile with lots and lots of warnings but no >> "errors" >> >> I don't know much about C++ unfortunately. These errors look like >> simple errors which I could see might be generated if the syntax of >> the language had changed slightly from one version to the next .. >> >> Thanks for you help! >> >> Sean >> >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: >> error: ISO C++ forbids forward references to 'enum' types >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: >> error: expected '(' for function-style cast or type construction >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> ~~~ ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: >> error: field has incomplete type 'enum direction' >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: >> error: ISO C++ forbids forward references to 'enum' types >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: >> error: expected '(' for function-style cast or type construction >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> ~~~ ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: >> error: field has incomplete type 'enum direction' >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >>^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: >> note: forward declaration of 'IMUSANT::direction' >> >> enum direction : int { descending=-1, repeat=0, ascending = 1, >> vertical_bottomtotop }; >> >> ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: >> error: ISO C++ forbids forward references to 'enum' types >> >> enum basic : int { unison = 0, second=1, third, fourth, fifth, >> sixth, seventh }; >> >> ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: >> error: expected '(' for function-style cast or type construction >> >> enum basic : int { unison = 0, second=1, third, fourth, fifth, >> sixth, seventh }; >> >> ~~~ ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: >> error: field has incomplete type 'enum basic' >> >> enum basic : int { unison = 0, second=1, third, fourth, fifth, >> sixth, seventh }; >> >> >> sers/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: >> error: ISO C++ forbids forward references to 'enum' types >> >> enum basic : int { unison = 0, second=1, third, fourth, fifth, >> sixth, seventh }; >> >> ^ >> >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: >> error: expected '('
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
On 07-07-17 05:14, Sean Wayland wrote: > Hi Micha, > Thanks very much for the email. That seemed to make a small > difference! With both those lines commented out these errors are > generated ( below my email ) . > I still have included > project(CATSMAT) > at the top line of the cmake file in the catsmat directory > > I tried commenting out each of those language type definitions > separately but it didn't seem to help. > The code compiles under xcode. Those language types ( C++14) are > specified in Xcode so I was trying to find a way to copy what is in > xcode. > > Is there a maximum number of "errors" before the clion compiler will > spit the dummy ? > > Another executable will compile with lots and lots of warnings but no "errors" > > I don't know much about C++ unfortunately. These errors look like > simple errors which I could see might be generated if the syntax of > the language had changed slightly from one version to the next .. > > Thanks for you help! > > Sean > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > error: ISO C++ forbids forward references to 'enum' types > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: > error: expected '(' for function-style cast or type construction > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: > error: field has incomplete type 'enum direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > error: ISO C++ forbids forward references to 'enum' types > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: > error: expected '(' for function-style cast or type construction > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: > error: field has incomplete type 'enum direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > >^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: > note: forward declaration of 'IMUSANT::direction' > > enum direction : int { descending=-1, repeat=0, ascending = 1, > vertical_bottomtotop }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: > error: ISO C++ forbids forward references to 'enum' types > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: > error: expected '(' for function-style cast or type construction > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: > error: field has incomplete type 'enum basic' > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > > sers/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: > error: ISO C++ forbids forward references to 'enum' types > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: > error: expected '(' for function-style cast or type construction > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > ~~~ ^ > > /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: > error: field has incomplete type 'enum basic' > > enum basic : int { unison = 0, second=1, third, fourth, fifth, > sixth, seventh }; > > > > >
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
Hi Micha, Thanks very much for the email. That seemed to make a small difference! With both those lines commented out these errors are generated ( below my email ) . I still have included project(CATSMAT) at the top line of the cmake file in the catsmat directory I tried commenting out each of those language type definitions separately but it didn't seem to help. The code compiles under xcode. Those language types ( C++14) are specified in Xcode so I was trying to find a way to copy what is in xcode. Is there a maximum number of "errors" before the clion compiler will spit the dummy ? Another executable will compile with lots and lots of warnings but no "errors" I don't know much about C++ unfortunately. These errors look like simple errors which I could see might be generated if the syntax of the language had changed slightly from one version to the next .. Thanks for you help! Sean /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: error: ISO C++ forbids forward references to 'enum' types enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: error: expected '(' for function-style cast or type construction enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; ~~~ ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: error: field has incomplete type 'enum direction' enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: error: ISO C++ forbids forward references to 'enum' types enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:30: error: expected '(' for function-style cast or type construction enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; ~~~ ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:24: error: field has incomplete type 'enum direction' enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:78:14: note: forward declaration of 'IMUSANT::direction' enum direction : int { descending=-1, repeat=0, ascending = 1, vertical_bottomtotop }; ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: error: ISO C++ forbids forward references to 'enum' types enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: error: expected '(' for function-style cast or type construction enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; ~~~ ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: error: field has incomplete type 'enum basic' enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; sers/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:14: error: ISO C++ forbids forward references to 'enum' types enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:26: error: expected '(' for function-style cast or type construction enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; ~~~ ^ /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/DomainObjects/inc/IMUSANT_interval.h:80:20: error: field has incomplete type 'enum basic' enum basic : int { unison = 0, second=1, third, fourth, fifth, sixth, seventh }; /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat/cmake/../../libIMUSANT/FileProcessing/inc/IMUSANT_processing.h:61:35: error: expected ';' at end of declaration list const char * what () const noexcept ^ ^ 22 warnings
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
On 06-07-17 15:59, Sean Wayland wrote: > Hi Micha, > Thanks very much I tried that .. I added it to the application > directory cmakelists.txt file . Same issue .. It's already in the top > level cmake file which looks like this .. > > project(CATSMAT) > cmake_minimum_required(VERSION 3.6.3) > > > if (APPLE) > > set(CMAKE_C++_FLAGS -mmacosx-version-min=10.4) > endif (APPLE) > > > include_directories("catsmat/libIMUSANT") > > add_subdirectory (catsmat/googletest-master/googletest) > add_subdirectory (catsmat/libMusicXMLv3/libmusicxml-3.00-src/cmake) > add_subdirectory (catsmat/libIMUSANT/cmake) > add_subdirectory (catsmat/libIMUSANT_Tests/cmake) > add_subdirectory (catsmat/catsmat/cmake) > > set(CMAKE_CXX_STANDARD 14) > > On Thu, Jul 6, 2017 at 2:48 AM, Micha Hergarden >wrote: >> On 05-07-17 22:50, Sean Wayland wrote: >>> I am attempting to write a cmakelists.txt file for an application. >>> The application has a couple of dependencies. >>> I have been able to build targets for the dependencies but when I try >>> and add an executable for the main application I encounter this error. >>> >>> Undefined symbols for architecture x86_64: >>> >>> "_main", referenced from: >>> >>> implicit entry/start for main executable >>> >>> ld: symbol(s) not found for architecture x86_64 >>> >>> clang: error: linker command failed with exit code 1 (use -v to see >>> invocation) >>> >>> >>> Googling the error and looking on stack exchange suggests that I don't >>> have a main function in the implicit entry/start . >>> >>> Where does it look for this function ? >>> Does that file need to be first in the list of sources ? >>> >>> >>> >>> This function is included here : >>> ${CATSMAT_DIR}/Application/CATSMAT_main.cpp >>> >>> My cmake file is below. >>> >>> Any advice would be appreciated I have been stuck here for a while! >>> >>> Best Sean >>> >>> >>> ### >>> # CMAKE CATSTMAT >>> ### >>> cmake_minimum_required(VERSION 3.6.3) >>> set(CMAKE_CXX_STANDARD 14) >>> if(CMAKE_CONFIGURATION_TYPES) >>> set(CMAKE_CONFIGURATION_TYPES Debug Release) >>> endif() >>> >>> if(UNIX) >>> add_definitions(-Wall -DGCC) >>> endif(UNIX) >>> >>> # RPATH SETTING # >>> set(CMAKE_MACOSX_RPATH 1) >>> >>> #if(APPLE) >>> # set (CMAKE_OSX_ARCHITECTURES "x86_64 i386") >>> # if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0) >>> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) >>> # elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0) >>> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) >>> # elseif (${XCODE_VERSION} VERSION_LESS 4.0.0) >>> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk) >>> # else () >>> # set (CMAKE_OSX_SYSROOT "macosx10.7") >>> # endif () >>> # set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4) >>> #endif(APPLE) >>> # >>> #if(WIN32) >>> # add_definitions(-DWINVER=0x0400 -DWIN32) >>> # if(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") >>> # add_definitions(-DVC6) >>> # elseif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 8 2005") >>> # add_definitions(-DVC2005) >>> # endif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") >>> #endif(WIN32) >>> >>> ### BOOST LIBRARIES ### >>> if (APPLE) >>> set(BOOST_ROOT "/usr/local/boost") >>> set(BOOST_FILESYSTEM_LIB /usr/local/boost/lib/libboost_filesystem.dylib) >>> set(BOOST_SYSTEM_LIB /usr/local/boost/lib/libboost_system.dylib) >>> >>> else (NOT APPLE) >>> set(BOOST_ROOT "C:/local/boost_1_58_0") >>> set(BOOST_FILESYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) >>> set(BOOST_SYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) >>> endif (APPLE) >>> >>> FIND_PACKAGE( Boost 1.58.0 REQUIRED ) >>> INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) >>> >>> >>> ### >>> # set directories, src and headers. >>> >>> set (CATSMAT_DIR >>> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat ) >>> set (libIMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) >>> set (LOKI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Loki) >>> set (SUFFIX_TREE_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../SuffixTree) >>> set (GOOGLE_TEST_INC_DIR >>> ${CMAKE_CURRENT_SOURCE_DIR}/../../googletest-master/googletest/include) >>> set (IMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) >>> >>> >>> set (LIBMUSICXML_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libMusicXMLv3) >>> >>> >>> SET SOURCES EXPLICITLY # >>> >>> set(SRC >>> >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_contour_suffixtree_builder.cpp >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_generalised_interval_suffixtree_builder.cpp >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_interval_suffixtree_builder.cpp >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_pitch_suffixtree_builder.cpp >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_repeated_interval_substring.cpp >>> ${CATSMAT_DIR}/Analysis/src/IMUSANT_t_repeated_substring.cpp >>>
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
Hi Micha, Thanks very much I tried that .. I added it to the application directory cmakelists.txt file . Same issue .. It's already in the top level cmake file which looks like this .. project(CATSMAT) cmake_minimum_required(VERSION 3.6.3) if (APPLE) set(CMAKE_C++_FLAGS -mmacosx-version-min=10.4) endif (APPLE) include_directories("catsmat/libIMUSANT") add_subdirectory (catsmat/googletest-master/googletest) add_subdirectory (catsmat/libMusicXMLv3/libmusicxml-3.00-src/cmake) add_subdirectory (catsmat/libIMUSANT/cmake) add_subdirectory (catsmat/libIMUSANT_Tests/cmake) add_subdirectory (catsmat/catsmat/cmake) set(CMAKE_CXX_STANDARD 14) On Thu, Jul 6, 2017 at 2:48 AM, Micha Hergardenwrote: > On 05-07-17 22:50, Sean Wayland wrote: >> I am attempting to write a cmakelists.txt file for an application. >> The application has a couple of dependencies. >> I have been able to build targets for the dependencies but when I try >> and add an executable for the main application I encounter this error. >> >> Undefined symbols for architecture x86_64: >> >> "_main", referenced from: >> >> implicit entry/start for main executable >> >> ld: symbol(s) not found for architecture x86_64 >> >> clang: error: linker command failed with exit code 1 (use -v to see >> invocation) >> >> >> Googling the error and looking on stack exchange suggests that I don't >> have a main function in the implicit entry/start . >> >> Where does it look for this function ? >> Does that file need to be first in the list of sources ? >> >> >> >> This function is included here : >> ${CATSMAT_DIR}/Application/CATSMAT_main.cpp >> >> My cmake file is below. >> >> Any advice would be appreciated I have been stuck here for a while! >> >> Best Sean >> >> >> ### >> # CMAKE CATSTMAT >> ### >> cmake_minimum_required(VERSION 3.6.3) >> set(CMAKE_CXX_STANDARD 14) >> if(CMAKE_CONFIGURATION_TYPES) >> set(CMAKE_CONFIGURATION_TYPES Debug Release) >> endif() >> >> if(UNIX) >> add_definitions(-Wall -DGCC) >> endif(UNIX) >> >> # RPATH SETTING # >> set(CMAKE_MACOSX_RPATH 1) >> >> #if(APPLE) >> # set (CMAKE_OSX_ARCHITECTURES "x86_64 i386") >> # if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0) >> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) >> # elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0) >> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) >> # elseif (${XCODE_VERSION} VERSION_LESS 4.0.0) >> # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk) >> # else () >> # set (CMAKE_OSX_SYSROOT "macosx10.7") >> # endif () >> # set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4) >> #endif(APPLE) >> # >> #if(WIN32) >> # add_definitions(-DWINVER=0x0400 -DWIN32) >> # if(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") >> # add_definitions(-DVC6) >> # elseif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 8 2005") >> # add_definitions(-DVC2005) >> # endif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") >> #endif(WIN32) >> >> ### BOOST LIBRARIES ### >> if (APPLE) >> set(BOOST_ROOT "/usr/local/boost") >> set(BOOST_FILESYSTEM_LIB /usr/local/boost/lib/libboost_filesystem.dylib) >> set(BOOST_SYSTEM_LIB /usr/local/boost/lib/libboost_system.dylib) >> >> else (NOT APPLE) >> set(BOOST_ROOT "C:/local/boost_1_58_0") >> set(BOOST_FILESYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) >> set(BOOST_SYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) >> endif (APPLE) >> >> FIND_PACKAGE( Boost 1.58.0 REQUIRED ) >> INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) >> >> >> ### >> # set directories, src and headers. >> >> set (CATSMAT_DIR >> /Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat ) >> set (libIMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) >> set (LOKI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Loki) >> set (SUFFIX_TREE_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../SuffixTree) >> set (GOOGLE_TEST_INC_DIR >> ${CMAKE_CURRENT_SOURCE_DIR}/../../googletest-master/googletest/include) >> set (IMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) >> >> >> set (LIBMUSICXML_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libMusicXMLv3) >> >> >> SET SOURCES EXPLICITLY # >> >> set(SRC >> >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_contour_suffixtree_builder.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_generalised_interval_suffixtree_builder.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_interval_suffixtree_builder.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_pitch_suffixtree_builder.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_repeated_interval_substring.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_t_repeated_substring.cpp >> ${CATSMAT_DIR}/Analysis/src/IMUSANT_VectorMapAnalysisTypes.cpp >> >> ${CATSMAT_DIR}/Application/CATSMAT_main.cpp >> ${CATSMAT_DIR}/Application/CATSMAT_menu.cpp >> >> ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_chord.cpp >>
Re: [CMake] cmake create executable Undefined symbols for architecture x86_64:
On 05-07-17 22:50, Sean Wayland wrote: > I am attempting to write a cmakelists.txt file for an application. > The application has a couple of dependencies. > I have been able to build targets for the dependencies but when I try > and add an executable for the main application I encounter this error. > > Undefined symbols for architecture x86_64: > > "_main", referenced from: > > implicit entry/start for main executable > > ld: symbol(s) not found for architecture x86_64 > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > Googling the error and looking on stack exchange suggests that I don't > have a main function in the implicit entry/start . > > Where does it look for this function ? > Does that file need to be first in the list of sources ? > > > > This function is included here : > ${CATSMAT_DIR}/Application/CATSMAT_main.cpp > > My cmake file is below. > > Any advice would be appreciated I have been stuck here for a while! > > Best Sean > > > ### > # CMAKE CATSTMAT > ### > cmake_minimum_required(VERSION 3.6.3) > set(CMAKE_CXX_STANDARD 14) > if(CMAKE_CONFIGURATION_TYPES) > set(CMAKE_CONFIGURATION_TYPES Debug Release) > endif() > > if(UNIX) > add_definitions(-Wall -DGCC) > endif(UNIX) > > # RPATH SETTING # > set(CMAKE_MACOSX_RPATH 1) > > #if(APPLE) > # set (CMAKE_OSX_ARCHITECTURES "x86_64 i386") > # if (${CMAKE_SYSTEM_VERSION} VERSION_LESS 9.0.0) > # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) > # elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 10.8.0) > # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) > # elseif (${XCODE_VERSION} VERSION_LESS 4.0.0) > # set (CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.6.sdk) > # else () > # set (CMAKE_OSX_SYSROOT "macosx10.7") > # endif () > # set (CMAKE_C++_FLAGS -mmacosx-version-min=10.4) > #endif(APPLE) > # > #if(WIN32) > # add_definitions(-DWINVER=0x0400 -DWIN32) > # if(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") > # add_definitions(-DVC6) > # elseif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 8 2005") > # add_definitions(-DVC2005) > # endif(${CMAKE_GENERATOR} STREQUAL "Visual Studio 6") > #endif(WIN32) > > ### BOOST LIBRARIES ### > if (APPLE) > set(BOOST_ROOT "/usr/local/boost") > set(BOOST_FILESYSTEM_LIB /usr/local/boost/lib/libboost_filesystem.dylib) > set(BOOST_SYSTEM_LIB /usr/local/boost/lib/libboost_system.dylib) > > else (NOT APPLE) > set(BOOST_ROOT "C:/local/boost_1_58_0") > set(BOOST_FILESYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) > set(BOOST_SYSTEM_LIB C:/local/boost_1_58_0/lib64-msvc-12.0) > endif (APPLE) > > FIND_PACKAGE( Boost 1.58.0 REQUIRED ) > INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) > > > ### > # set directories, src and headers. > > set (CATSMAT_DIR/Users/seanwayland/Desktop/CATSMAT-master/catsmat/catsmat > ) > set (libIMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) > set (LOKI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../Loki) > set (SUFFIX_TREE_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../SuffixTree) > set (GOOGLE_TEST_INC_DIR > ${CMAKE_CURRENT_SOURCE_DIR}/../../googletest-master/googletest/include) > set (IMUSANT_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libIMUSANT) > > > set (LIBMUSICXML_DIR${CMAKE_CURRENT_SOURCE_DIR}/../../libMusicXMLv3) > > > SET SOURCES EXPLICITLY # > > set(SRC > > ${CATSMAT_DIR}/Analysis/src/IMUSANT_contour_suffixtree_builder.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_generalised_interval_suffixtree_builder.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_interval_suffixtree_builder.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_pitch_suffixtree_builder.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_repeated_interval_substring.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_t_repeated_substring.cpp > ${CATSMAT_DIR}/Analysis/src/IMUSANT_VectorMapAnalysisTypes.cpp > > ${CATSMAT_DIR}/Application/CATSMAT_main.cpp > ${CATSMAT_DIR}/Application/CATSMAT_menu.cpp > > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_chord.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_collectionvisitor.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_cp_matrix.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_dyad_sequences.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_dyadtuple_sequences.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_sonority_sequences.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_TrigramSequences.cpp > ${CATSMAT_DIR}/CounterpointAnalysis/src/CATSMAT_TrigramSuffixTreeBuilder.cpp > > ${CATSMAT_DIR}/GeneralAnalysis/src/CATSMAT_canonic_techniques_tools.cpp > ${CATSMAT_DIR}/GeneralAnalysis/src/CATSMAT_partdata.cpp > ${CATSMAT_DIR}/GeneralAnalysis/src/CATSMAT_processing.cpp > ${CATSMAT_DIR}/GeneralAnalysis/src/CATSMAT_score_profile.tpp > ${CATSMAT_DIR}/GeneralAnalysis/src/CATSMAT_score_splitter.cpp >