amrex icon indicating copy to clipboard operation
amrex copied to clipboard

how to use cmake file to compile a tutorial in kdevelop

Open ztdepztdep opened this issue 2 years ago • 1 comments

cmake_minimum_required(VERSION 2.6) project(amrex) include_directories(/home/ztdep/lib/amrex/include) include_directories(/usr/local/cuda/include) link_directories(/home/ztdep/lib/amrex/lib64) link_directories(/usr/lib/hpc/gnu7/mpi/mpich/3.2.1/lib64) link_directories(/usr/local/cuda/lib64/stubs/) add_executable(main main.cpp) target_link_libraries (main amrex cuda gfortran)

I write a cmake file to compile the HelloWorld.c in kdevelop4. but it feedback many error about

/home/ztdep/lib/amrex/include/AMReX_Box.H:1730:7: error: ‘class amrex::Box’ has no member named ‘setType’; did you mean ‘btype’? b.setType(b2.ixType()); ^~~~~~~ btype /home/ztdep/lib/amrex/include/AMReX_Box.H:1730:18: error: ‘const class amrex::Box’ has no member named ‘ixType’; did you mean ‘btype’? b.setType(b2.ixType()); ^~~~~~ btype /home/ztdep/lib/amrex/include/AMReX_Box.H:1731:7: error: ‘class amrex::Box’ has no member named ‘minBox’; did you mean ‘Box’? b.minBox(b2); ^~~~~~ Box

ztdepztdep avatar Sep 04 '21 06:09 ztdepztdep

Hi,

I don't normally use KDevelop but I have a few suggestions for things you could try that may help you get things running:

  1. Check your version of CMake, at a terminal cmake --version. I'm currently using version 3.21.2.
  2. Can you compile the HelloWorld example outside of KDevelop?
  3. Finally, I was able to get something working by short cutting some of KDevelop's interface. After making a project called HelloWorld, I was able to navigate to the location of the project's CMake file, i.e. ~/projects/HelloWorld . In that directory I copied the CMakeLists.txt I use to compile the HelloWorld example in the coming Guided Tutorial (can be found in the PR: here ). Then when I return to KDevelop and copy and paste the HelloWorld.cpp syntax into the project and press build it will build. When I look in the directory ~/projects/HelloWorld/build/ I see the executable HelloWorld. I can run it by typing ./HelloWorld.

etpalmer63 avatar Sep 23 '21 14:09 etpalmer63