[Trilinos-Users] Problem running my own example with visual studio 2013

Chetan Jhurani chetan.jhurani at gmail.com
Tue Sep 16 12:09:41 MDT 2014


One more point: the cmake generator in your example should match the

cmake generator for Trilinos.

 

From: Chetan Jhurani [mailto:chetan.jhurani at gmail.com] 
Sent: Tuesday, September 16, 2014 11:08 AM
To: 'Sam Duckitt'; 'trilinos-users at software.sandia.gov'
Subject: RE: [Trilinos-Users] Problem running my own example with visual studio 2013

 

First, you should try to get rid of the warning perhaps using the suggestion here.

http://www.cmake.org/pipermail/cmake/2014-September/058517.html

 

Second, make sure TRILINOS_PATH in your cmake call for the example points to the

path to your Trilinos installation and not source code base directory.  And make sure that

installation has include/lib directories and Epetra_SerialComm.h is present there.

 

If this still leads to the error that Epetra_SerialComm.h is not found,

then check for the include paths in visual studio project properties.

 

Chetan

 

From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf Of Sam Duckitt
Sent: Tuesday, September 16, 2014 2:46 AM
To: trilinos-users at software.sandia.gov
Subject: [Trilinos-Users] Problem running my own example with visual studio 2013

 

Thanks for your reply. 

 

When I opened my example project in visual studio I changed the solution platform from Win32 to x64 which got rid of the error,
however this has been replaced with a new error:

 

2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(381,5): warning MSB8028: The intermediate
directory (x64\Debug\) contains files shared from another project (ZERO_CHECK.vcxproj).  This can lead to incorrect clean and
rebuild behavior.

2>  main.cpp

2>main.cpp(43): fatal error C1083: Cannot open include file: 'Epetra_SerialComm.h': No such file or directory

 

This is probably a really silly error on my part but I'm new to Trilinos and still confused about this. As I mentioned I am just
trying to run a very simplified Epetra example. Here is the code from my main.cpp file:

 

#include "Epetra_SerialComm.h"

#include "Epetra_Map.h"

#include "Epetra_Vector.h"

#include "Epetra_Version.h"

 

int main(int argc, char *argv[])

{

 

  std::cout << Epetra_Version() << std::endl << std::endl;

 

  Epetra_SerialComm Comm;

 

  int NumElements = 1000;

 

  std::cout << "NumElements = " << NumElements << std::endl;

 

  return 0;

}

 

Do I need to list the header files Epetra_SerialComm.h, ... ,Epetra_Version.h in the sources part of the CMakeLists.txt file? I have
tried doing this and I then get an error that it cannot open include file: Épetra_config.h. 

 

Here is my do-configure file:

-------------------------------------------------------------------------------------------

 

cmake \

  -D TRILINOS_PATH:FILEPATH="C:/Trilinos" \

  -D CMAKE_BUILD_TYPE:STRING=DEBUG \

  -D BUILD_SHARED_LIBS:BOOL=OFF \

  -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \

.

 

-------------------------------------------------------------------------------------------

 

And CMakeLists.txt:

 

-------------------------------------------------------------------------------------------

# You need CMake version >= 2.8 to use this example.

cmake_minimum_required(VERSION 2.8)

 

# Your "do-configure" script that invokes CMake should set

# TRILINOS_PATH to the path to your Trilinos install.

# You do _not_ need to edit this line.

FIND_PACKAGE(Trilinos PATHS ${TRILINOS_PATH}/lib/cmake/Trilinos ${TRILINOS_PATH})

 

# If FIND_PACKAGE successfully found your Trilinos install, it will

# set the Boolean flag Trilinos_FOUND.  The following IF statement

# fails with a FATAL_ERROR if Trilinos was not found.  If it _was_

# found, it prints out the values of some Trilinos configuration

# details.  You may find them useful for building your application

# that uses Trilinos.

IF(Trilinos_FOUND)

   MESSAGE("\nFound Trilinos!  Here are the details: ")

   MESSAGE("   Trilinos_DIR = ${Trilinos_DIR}")

   MESSAGE("   Trilinos_VERSION = ${Trilinos_VERSION}")

   MESSAGE("   Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}")

   MESSAGE("   Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}")

   MESSAGE("   Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}")

   MESSAGE("   Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}")

   MESSAGE("   Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}")

   MESSAGE("   Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}")

   MESSAGE("   Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}")

   MESSAGE("   Trilinos_CXX_COMPILER = ${Trilinos_CXX_COMPILER}")

   MESSAGE("   Trilinos_C_COMPILER = ${Trilinos_C_COMPILER}")

   MESSAGE("   Trilinos_Fortran_COMPILER = ${Trilinos_Fortran_COMPILER}")

   MESSAGE("   Trilinos_CXX_COMPILER_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}")

   MESSAGE("   Trilinos_C_COMPILER_FLAGS = ${Trilinos_C_COMPILER_FLAGS}")

   MESSAGE("   Trilinos_Fortran_COMPILER_FLAGS =

     ${Trilinos_Fortran_COMPILER_FLAGS}")

   MESSAGE("   Trilinos_LINKER = ${Trilinos_LINKER}")

   MESSAGE("   Trilinos_EXTRA_LD_FLAGS = ${Trilinos_EXTRA_LD_FLAGS}")

   MESSAGE("   Trilinos_AR = ${Trilinos_AR}")

   MESSAGE("End of Trilinos details\n")

ELSE()

  MESSAGE(FATAL_ERROR "Could not find Trilinos!")

ENDIF()

 

# If you haven't already set the C++ compiler, use the same compiler

# that was used to build Trilinos on your machine.  You do _not_ need

# to edit this line.

IF(NOT CMAKE_CXX_COMPILER)

  MESSAGE("Setting CXX compiler.")

  SET(CMAKE_CXX_COMPILER ${Trilinos_CXX_COMPILER})

ENDIF()

 

# If you haven't already set the C compiler, use the same compiler

# that was used to build Trilinos on your machine.  You do _not_ 

# need to edit this line.

IF(NOT CMAKE_C_COMPILER)

  MESSAGE("Setting C compiler.")

  SET(CMAKE_C_COMPILER ${Trilinos_C_COMPILER})

ENDIF()

 

#

# EDIT HERE: Replace TrilinosExample with your project's name.

#

project(trilinosExample)

 

# 

# EDIT HERE: 

#

# Source file(s) in your project.  Here, we include one source file, 

# main.cpp, which contains the main() function.  You may also want to 

# set HEADERS to the list of header files in your project, if there 

# are any.

#

set(SOURCES

  main.cpp

  )

 

# 

# EDIT HERE:

#

# Add to the header include path the current directory, Trilinos'

# include directory, and the include directories of the third-party

# libraries (TPLs) with which Trilinos was built.

#

include_directories(".")

include_directories(${Trilinos_INCLUDE_DIRS})

include_directories(C:/Trilinos/include)

include_directories(${Trilinos_TPL_INCLUDE_DIRS})

 

 

# Add to the library path Trilinos' library path, and the library

# paths of the third-party libraries (TPLs) with which Trilinos was

# built.  

link_directories(${Trilinos_LIBRARY_DIRS})

link_directories(C:/Trilinos/lib)

link_directories(C:/Users/sam.ALE/lib/lapack)

link_directories(C:/Users/sam.ALE/lib/libblas)

link_directories(${Trilinos_TPL_LIBRARY_DIRS})

 

 

# 

# EDIT HERE: Change trilinosExample to the name of the executable

# file that you want to build.  This line tells CMake which source

# file(s) to use to build the executable.

#

add_executable(trilinosExample ${SOURCES})

 

#

# EDIT HERE: Change trilinosExample to the name of the executable

# file, as above.  This line tells the linker to link the executable 

# with the Trilinos libraries, and with the third-party libraries 

# (TPLs) with which Trilinos was built.

#

target_link_libraries(trilinosExample

  ${Trilinos_LIBRARIES} 

  ${Trilinos_TPL_LIBRARIES}

  ) 

-------------------------------------------------------------------------------------------

 

Sorry if I have made a stupid mistake somewhere but I'm finding this very confusing. Any help would be greatly appreciated.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20140916/3c5895af/attachment-0001.html>


More information about the Trilinos-Users mailing list