[CMake] Help cmake First project
Angeliki Chrysochou
angeliki.chrysochou at gmail.com
Mon Aug 4 10:44:44 EDT 2014
Hi Rodrigo,
Where is the implementation of the undefined references?
If it is in another source file (other than protpred-Gromacs-NSGA2.c, which
seems to be the only one you are compiling) you should add it to the
compilation. If it is in another library that is already compiled, you
should add it as a linking dependency (using target_link_libraries).
Check out http://www.cmake.org/cmake/help/cmake_tutorial.html
Cheers!
Angeliki
On Mon, Aug 4, 2014 at 4:26 PM, Rodrigo Faccioli <rodrigo.faccioli at gmail.com
> wrote:
> Hi,
>
> I'm trying to use cmake in my project. In fact, it is my first time using
> cmake.
>
> My CmakeList file is below. You can see it is very simple because I'm
> trying to compile a binary.
>
> cmake_minimum_required(VERSION 2.8)
>
> project(2pg_cartesian)
> set(PROJECT_VERSION "1.0")
>
> include_directories(${2pg_cartesian_SOURCE_DIR}/include)
>
> add_executable(protpred-Gromacs-NSGA2
> ${2pg_cartesian_SOURCE_DIR}/src/protpred-Gromacs-NSGA2.c)
>
> install(TARGETS protpred-Gromacs-NSGA2 DESTINATION bin)
>
> When I run cmake .. I receive Build files have been written to:
> /home/faccioli/Downloads/2pg_cartesian/build. I understand that all is
> ok.
>
> faccioli at faccioli:~/Downloads/2pg_cartesian/build$ cmake ..
> -- The C compiler identification is GNU 4.7.2
> -- The CXX compiler identification is GNU 4.7.2
> -- Check for working C compiler: /usr/bin/gcc
> -- Check for working C compiler: /usr/bin/gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Configuring done
> -- Generating done
> -- Build files have been written to:
> /home/faccioli/Downloads/2pg_cartesian/build
> faccioli at faccioli:~/Downloads/2pg_cartesian/build$
>
> However, when I run make, I receive an error message as below:
>
> faccioli at faccioli:~/Downloads/2pg_cartesian/build$ make
> Scanning dependencies of target protpred-Gromacs-NSGA2
> [100%] Building C object
> CMakeFiles/protpred-Gromacs-NSGA2.dir/src/protpred-Gromacs-NSGA2.c.o
> Linking C executable protpred-Gromacs-NSGA2
> CMakeFiles/protpred-Gromacs-NSGA2.dir/src/protpred-Gromacs-NSGA2.c.o: In
> function `main':
> protpred-Gromacs-NSGA2.c:(.text+0x1e): undefined reference to `display_msg'
> protpred-Gromacs-NSGA2.c:(.text+0x3e): undefined reference to
> `load_parameters_from_file'
> protpred-Gromacs-NSGA2.c:(.text+0x58): undefined reference to `ea_nsga2'
> protpred-Gromacs-NSGA2.c:(.text+0x64): undefined reference to `fatal_error'
> protpred-Gromacs-NSGA2.c:(.text+0x73): undefined reference to
> `deAllocateload_parameters'
> protpred-Gromacs-NSGA2.c:(.text+0x7d): undefined reference to `display_msg'
> collect2: error: ld returned 1 exit status
> make[2]: ** [protpred-Gromacs-NSGA2] Erro 1
> make[1]: ** [CMakeFiles/protpred-Gromacs-NSGA2.dir/all] Erro 2
> make: ** [all] Erro 2
> faccioli at faccioli:~/Downloads/2pg_cartesian/build$
>
> Could you help me understand how can I fix this problem?
>
> I appreciate any help.
>
> Best regards,
>
> --
> Rodrigo Antonio Faccioli, Ph.D
> Development Software for Structural Bioinformatics
> Barao de Maua University
> University of Sao Paulo
> Lindedin - br.linkedin.com/pub/rodrigo-antonio-faccioli/7/589/a5/
> Curriculum Lattes - http://lattes.cnpq.br/1025157978990218
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140804/0497d1fe/attachment-0001.html>
More information about the CMake
mailing list