How can I fix libstdc++ (or does it need fixing?) - c++

I have been trying to install HEALPix over the last few days on my iMac and I am at something of a dead end as to how to proceed. When I run the necessary make command, I am told that the file string does not exist.
# compiling Healpix_cxx/syn_alm_cxx.cc
cd /Users/keir/Software/Healpix_3.11/src/cxx/build.osx/Healpix_cxx && g++ -I/usr/local
/include -I/Users/keir/Software/Healpix_3.11/src/cxx/c_utils -I/Users/keir/Software
/Healpix_3.11/src/cxx/libfftpack -I/Users/keir/Software/Healpix_3.11/src/cxx/libsharp
-I/Users/keir/Software/Healpix_3.11/src/cxx/cxxsupport -I/Users/keir/Software/
Healpix_3.11/src/cxx/Healpix_cxx -I/Users/keir/Software/Healpix_3.11/src/cxx/alice
-I/Users/keir/Software/Healpix_3.11/src/cxx/build.osx -Wall -Wextra -Wstrict-aliasing=2
-Wundef -Wshadow -Wwrite-strings -Wredundant-decls -Woverloaded-virtual -Wcast-qual
-Wcast-align -Wpointer-arith -Wold-style-cast -Wno-unknown-pragmas -Wfatal-errors -g
-fopenmp -fPIC -O2 -ffast-math -fomit-frame-pointer -ansi -fdata-sections
-ffunction-sections -c /Users/keir/Software/Healpix_3.11/src/cxx/Healpix_cxx/
syn_alm_cxx.cc
In file included from /Users/keir/Software/Healpix_3.11/src/cxx/Healpix_cxx/
syn_alm_cxx.cc:2:0:
/Users/keir/Software/Healpix_3.11/src/cxx/cxxsupport/error_handling.h:35:18: fatal
error: string: No such file or directory
#include <string>
^
compilation terminated.
make[1]: *** [/Users/keir/Software/Healpix_3.11/src/cxx/build.osx/Healpix_cxx/syn_alm_cxx.o] Error 1
I have had a look and it certainly does as is the whole of the libstdc++ library (I think). I have tried many solutions including re-installing Xcode and its Command Line Tools and trying various other versions of gcc (4.8, 4.9, 5.0 and a 4.9 copy from homebrew) - none of which solve the problem.
I have created a test file 'foo.cpp' with just #include <string> in it and this will still not compile even if I specify a directory for string with the -I tag, because it then can't find more headers that string depends on. It seems to me that libstdc++ isn't installed in the correct place? Or the '#include' command isn't looking in the right places? Do you have an idea as to how to fix this problem?

Related

clang-tidy with precompiled headers and cmake does not work

I have a simple setup where CMake produces the following compile command:
cd /workspaces/cmake-general/tests/project/build/examples/hello-world && /usr/local/bin/cmake -E __run_co_compile
--iwyu=/usr/local/bin/include-what-you-use
--tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++"
--source=/workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx --
/usr/bin/c++
-I/workspaces/cmake-general/tests/project/examples/hello-world/src
-I/workspaces/cmake-general/tests/project/build -O3 -DNDEBUG -stdlib=libc++
-fcolor-diagnostics -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion
-Wsign-conversion -Wnull-dereference -Wdouble-promotion
-Wformat=2 -Werror -std=c++20 -Winvalid-pch -fpch-instantiate-templates
-Xclang -emit-pch -Xclang -include
-Xclang /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx
-x c++-header -MD -MT examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch -MF
CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch.d -o CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch
-c /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx
which errors our with not finding
/workspaces/cmake-general/tests/project/build/examples/example-sanitizer/CMakeFiles/example-sanitizer-address.dir/cmake_pch.hxx:5:10: error: 'iostream' file not found [clang-diagnostic-error]
#include <iostream>
^
3 errors generated.
When I take --tidy="..." stuff out of the command. It fully compiles, (also if I dont specify PCHs in the CMakeLists.txt) it works.
I am not sure what the problem is exactly.
Do PCH and clang-tidy somehow not work? Why are the include directories somehow missing? I am using LLVM-12, clang-12 on Ubuntu.
Also adding -I/usr/lib/llvm-12/include/c++/v1 does not help.

Compilation error when using Xcode 9.0 with clang (cannot specify -o when generating multiple output files)

I updated my Xcode yesterday (version 9.0) and since then I cannot compile my code with clang anymore. It works great with with apple native compiler, but gives a compilation error with clang from macports. I will explain with more details now...
I usually use clang 4.0 because it has openmp support and I change in Xcode by creating a user-defined setting as in the following figure.
Image with how to use clang 4.0 from macports in Xcode
This has been working perfectly for some time until I updated to Xcode 9.0. Now, I get the following error from clang compiler:
cannot specify -o when generating multiple output files.
I researched a bit and a lot of people say this is because you may have .h files in the compilation table. I double checked and this is not my case. I also would think that this error would have happened with and older Xcode version.
Next, I am attaching the complete compilation command given by Xcode (it's a bit big though!).
CompileC /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/Objects-normal/x86_64/ComplexFloat.o SciEng/Algebra/ComplexFloat.C normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver
export LANG=en_US.US-ASCII
/opt/local/bin/clang-mp-4.0 -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug\" -DVECLIB_MAXIMUM_THREADS=8 -DPARALLEL_ON -DNUM_PROC=8 -DUSE_VTK -DvtkDomainsChemistry_AUTOINIT=1(vtkDomainsChemistryOpenGL2) -DvtkRenderingContext2D_AUTOINIT=1(vtkRenderingContextOpenGL2) -DvtkRenderingCore_AUTOINIT=3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) -DvtkRenderingOpenGL2_AUTOINIT=1(vtkRenderingGL2PSOpenGL2) -DvtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL2) -DUSE_CGAL -DCGAL_USE_MPFR -DCGAL_USE_GMP -DUSE_CGAL_EXACT_ARITHMETIC -DMKL_VERSION_11 -DUSE_PARDISO_MKL -DMKL_NUM_THREADS=8 -DXLC_QNOTEMPINC -DNO_IMPLICIT_TEMPLATE -DSCIENG_CHECK_SUBSCRIPTS -DBOOST_DEBUG=1 -DSET_DEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min=10.13 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -index-store-path /Users/Nathan/Library/Developer/Xcode/DerivedData/ISET-eireryvadmfrwyarbuzbnkopwhid/Index/DataStore -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/Debug/include -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Algebra -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Array -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/AutoDeriv -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/DataModeling -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Function -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/LapackWrap -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/SciEng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Units -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Vector -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/include -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/analysis -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/cholmod -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/cosys -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crackmg2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgeoeng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgeoeng2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgrphysics -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/extract -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/fiber_gfem -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/grgeoeng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/integration -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/ma27solver -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/material -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/material2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/mesh -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/mesh2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/pardiso -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/post -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/pre -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/python -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/renumber -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/tNewtonRaphason -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/topology -I/opt/local/include -I/opt/local/include/vtk-7.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/python2.7 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel -I/Users/Nathan/Documents/Programming/CGAL_CleanVersions/CGAL-4.10/compileXcode/include -I/Users/Nathan/Documents/Programming/CGAL_CleanVersions/CGAL-4.10/include -I/opt/intel/compilers_and_libraries_2016.2.146/mac/mkl/include -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/DerivedSources/x86_64 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/Debug -m64 -fopenmp -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Algebra -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Array -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/AutoDeriv -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/DataModeling -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Function -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/LapackWrap -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/SciEng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Units -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Vector -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/include -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/analysis -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/cholmod -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/cosys -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crackmg2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgeoeng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgeoeng2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/crgrphysics -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/extract -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/fiber_gfem -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/grgeoeng -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/integration -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/ma27solver -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/material -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/material2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/mesh -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/mesh2 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/pardiso -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/post -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/pre -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/python -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/renumber -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/tNewtonRaphason -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/topology -isystem /opt/local/include -I/opt/local/include/vtk-7.1 -I/usr/include/python2.7 -I/Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel -I/Users/Nathan/Documents/Programming/CGAL_CleanVersions/CGAL-4.10/compileXcode/include -I/Users/Nathan/Documents/Programming/CGAL_CleanVersions/CGAL-4.10/include -I/opt/intel/compilers_and_libraries_2016.2.146/mac/mkl/include -MMD -MT dependencies -MF /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/Objects-normal/x86_64/ComplexFloat.d --serialize-diagnostics /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/Objects-normal/x86_64/ComplexFloat.dia -c /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/SetSolver/SciEng/Algebra/ComplexFloat.C -o /Users/Nathan/Documents/Programming/ISET_CoupledFormulationMerged/ProjectXcodeParallel/lib/ISET.build/Debug/scieng.build/Objects-normal/x86_64/ComplexFloat.o
Note: I use CMake to generate the project.
I can supply any more information that might be needed
Thanks for the help!
Nathan
Xcode 9.0 adds -index-store-path to the build command. It's not supported in clang yet. See this explanation.
You can remove it by disabling the build option Index-While-Building Functionality in Xcode.

clang: error: -lm: 'linker' input unused while compiling on MacOSX

I am trying to compile a program mafTools on MacOSX using gnu make. I get the following error:
cd mafExtractor && make all
clang -std=c99 -stdlib=libstdc++ -O3 -c -O3 -Wall -Werror --pedantic -funroll-loops -DNDEBUG -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -I ../../sonLib/lib -I ../inc -I ../external src/mafExtractorAPI.c -o src/mafExtractorAPI.o.tmp -lm
This gives the error:
clang: error: -lm: 'linker' input unused [-Werror,-Wunused-command-line-argument]
make[1]: \*** [src/mafExtractorAPI.o] Error 1
make: \*** [mafExtractor.all] Error 2
I looked at similar errors but couldn't fix it. Any help will be much appreciated. Thanks!
This is the package: https://github.com/dentearl/mafTools/tree/master/mafExtractor
Everything else here compiled successfully.
This is the makefile:
https://github.com/dentearl/mafTools/blob/master/mafExtractor/Makefile
Thanks a bunch.
Your clang commaand includes the -c option which means you do not want to link and resolve external references, you just want to produce an unlinked object file.
Your -lm option says you want to link with the maths library.
Basically, the aforementioned options are incompatible - you cannot both link with the math library and not link.
TLDR; Remove -lm

GCC with -std=c++11 does not see C++ header files (via PyDSTool)

I am on a complex project built in python2.7 that uses the PyDSTool package for analysis of dynamical system. PyDSTool provides two C-based integrators - Radau and Dopri - which I want to use to integrate my system of equations whose source is coded in a bunch of C/C++ files.
I have little control on the package, and when I instantiate the integrator, I can only add headers *.H files, source files (*.C, *.CPP) and pass the directories to include in the search path of the compiler as well as libraries to link to.
Since a consistent part of the code is based on C++11 I am passing to the compiler also the argument -std=C++11.
Eventually, /PyDSTool/Generators/mixins.py launch a setup command (line 185) which in turn runs the command build_ext from distutils to which all the above flags are appended.
For the sake of clarity: the flags that I am appending are:
compile options: '-I/usr/lib64/python2.7/site-packages/numpy/core/include -I/home/maurizio/Dropbox/StabilityAnalysis_tmp -I/usr/local/pydstool/PyDSTool/integrator -I/usr/include/python2_7 -I/usr/include/numpy -I/home/maurizio/Dropbox/Ongoing_Projects/pycustommodules -I/home/maurizio/Dropbox/Ongoing_Projects/c_libraries -I/home/maurizio/Dropbox/Ongoing_Projects/c_libraries/models -I/home/maurizio/Dropbox/Ongoing_Projects/DePitta_PNAS/Software/Stability_Analysis/ -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c'
extra options: '-std=c++11 -w -Wno-return-type -Wall -lpython2.7 -lm -lgsl -lgslcblas -D__DOPRI__'
The resulting compilation command as issued by PyDSTool reads:
error: Command "gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/home/maurizio/Dropbox/StabilityAnalysis_tmp -I/usr/local/pydstool/PyDSTool/integrator -I/usr/include/python2_7 -I/usr/include/numpy -I/home/maurizio/Dropbox/Ongoing_Projects/pycustommodules -I/home/maurizio/Dropbox/Ongoing_Projects/c_libraries -I/home/maurizio/Dropbox/Ongoing_Projects/c_libraries/models -I/home/maurizio/Dropbox/Ongoing_Projects/DePitta_PNAS/Software/Stability_Analysis/ -I/usr/lib64/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c /home/maurizio/Dropbox/StabilityAnalysis_tmp/dop853_temp/ei_network_vf.c -o /home/maurizio/Dropbox/StabilityAnalysis_tmp/dop853_temp/home/maurizio/Dropbox/StabilityAnalysis_tmp/dop853_temp/ei_network_vf.o -std=c++11 -w -Wno-return-type -Wall -lpython2.7 -lm -lgsl -lgslcblas -D__DOPRI__" failed with exit status 1
Once looking into the build.log file automatically generated by PyDSTool, it turns out that the exit status is due to the fact that the compiler does not see the C++ libraries that are in several routines/libs used by my code, e.g.
/usr/include/blitz/blitz.h:45:18: fatal error: string: No such file or directory
#include <string>
^
Compilation Terminated
Now, it is not a problem of my code, because if I compile my code as a standalone in python or through scipy.weave with the same compile and extra options pasted above, it works. It is a problem of making PyDSTool build the code within the integrator. As I am NOT practical with distutils and all gcc options I hope there is some expert here that could provide me with some insight. I suspect in fact that I am missing some options or whatever to pass to the compiler.
Just for the sake of completeness. The issue I pointed out above does not have an easy workaround. PyDSTool C-based integrators (i.e. Radau and Dopri) cannot be compiled with source code for the equations in C++ but only in C. So either you recast your code in plain C or try to edit PyDSTool integrators and recast them in C++. The first option is likely the only one currently possible (at least to some non-experts as who is writing).

clang: warning: -lgtest: 'linker' input unused

I'm developing applications in C++11 and my compiler is CLang++ 3.3. I'm also using Netbeans 7.3 IDE on Linux Mint 14.
All of my tests are done with GoogleTest (gtest-1.6.0) and almost everything is working fine except the warning mentioned in the title of this post.
Here's the command line executed by netbeans as an example:
clang++ -pedantic-errors -lgtest -pthread -c -g -Wall -std=c++11 -pedantic-errors -lgtest -pthread -MMD -MP -MF build/Debug/CLang-Linux-x86/_ext/1802678175/main.o.d -o build/Debug/CLang-Linux-x86/_ext/1802678175/main.o ../GIT_CryptoCode/src/main.cpp
I don't know why, but the command contains twice some attributes which gives the same warning twice of course. This is what I did in the project properties :
If I remove the Additional options, gtest is not working and the command line becomes something like this : clang++ -c -g -Wall -std=c++11 .... What should I do to not get some attributes to be duplicates ?
Well, even with cmake, I got the warning with Clang (which appears once this time :)). I also tested with GCC 4.7 and I didn't get any warning. Here's the command line I use in a cmake file for GCC :
set (CMAKE_CXX_FLAGS "-Winline -Wall -Werror -pedantic-errors -pthread -std=c++11")
Thus, Clang seems to be the problem. Is anyone know where this warning come from and how to remove it ? Is this a Clang bug ?
Thanks for your help.
I want to thank #Fraser for his help that helps me to find out the way to remove the warnings. Basically, instead of writing -pedantic-errors -lgtest -pthread in the Additional options of the C++ compiler section which gives a duplicate warning, these attributes should be in the Linker section of the project.
So, the Additional Options in the C++ compiler section are left empty. Now, I can use the -Werror attribute without any problem.
Also, in the cmake file, the line
target_link_libraries(${Project_Name} ${GTEST_BOTH_LIBRARIES})
links the gtest library to the project. Thus, no need of -lgtest in
set (CMAKE_CXX_FLAGS "-Winline -Wall -Werror -pedantic-errors -pthread -std=c++11")
both, for GCC and Clang.