amrex
amrex copied to clipboard
how to use cmake file to compile a tutorial in kdevelop
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
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:
- Check your version of CMake, at a terminal
cmake --version
. I'm currently using version 3.21.2. - Can you compile the HelloWorld example outside of KDevelop?
- 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 theCMakeLists.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 executableHelloWorld
. I can run it by typing./HelloWorld
.