MatteoLacki / IsoSpec

Libraries for fine isotopic structure calculator.
Other
35 stars 10 forks source link

Example and tests do not compile #8

Closed hroest closed 5 years ago

hroest commented 5 years ago

When following the instructions, I get

$ c++ -std=c++11 -lIsoSpec++ -L. water.cpp
water.cpp: In function ‘int main()’:
water.cpp:7:5: error: ‘IsoSpec’ was not declared in this scope
     IsoSpec* iso = IsoSpec::IsoFromFormula("H2O1", 0.9);
     ^
water.cpp:7:14: error: ‘iso’ was not declared in this scope
     IsoSpec* iso = IsoSpec::IsoFromFormula("H2O1", 0.9);
              ^
water.cpp:7:20: error: ‘IsoSpec’ is not a class, namespace, or enumeration
     IsoSpec* iso = IsoSpec::IsoFromFormula("H2O1", 0.9);
                    ^
water.cpp:31:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
     delete iso;
            ^
water.cpp:57:15: error: expected type-specifier before ‘IsoSpecLayered’
     iso = new IsoSpecLayered(elementNumber, isotopeNumbers, atomCounts, isotope_masses, probs, 0.9);
               ^
water.cpp:81:12: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
     delete iso;

it seems the relevant code was removed in 7ba7b845462d7c12a64f4bd5697

Similarly when I try to run the tests, neither the C or C++ tests worked:

IsoSpec/tests/C$ make
clang++ -std=c++11 -x c++ test_IsoThresholdGenerator.c -o isoThreshold -lpthread
test_IsoThresholdGenerator.c:13:15: error: no matching function for call to 'setupIsoThresholdGenerator'
    void* p = setupIsoThresholdGenerator(
              ^~~~~~~~~~~~~~~~~~~~~~~~~~
./../../IsoSpec++/cwrapper.cpp:83:7: note: candidate function not viable: requires 5 arguments, but 9 were provided
void* setupIsoThresholdGenerator(void* iso,
      ^
1 error generated.
Makefile:2: recipe for target 'test_IsoThresholdGenerator' failed
make: *** [test_IsoThresholdGenerator] Error 1

IsoSpec/tests/C++$ make
clang++ -std=c++11 -Wall -I../../IsoSpec++ -Wextra -pedantic -lpthread -O3 -march=native -mtune=native `ls ../../IsoSpec++/*.cpp` from_formula.cpp -o ./from_formula_clang
In file included from ../../IsoSpec++/spectrum.cpp:20:
../../IsoSpec++/spectrum.h:118:11: error: unknown type name 'IsoSpec'
        Spectrum(IsoSpec& iso, FunctionalKernel& k, double _bucketsize);
                 ^
../../IsoSpec++/spectrum.cpp:111:74: warning: unused parameter '_clear' [-Wunused-parameter]
Spectrum::Spectrum(double _start, double _bucketsize, int _buckets, bool _clear)
                                                                         ^
../../IsoSpec++/spectrum.cpp:119:20: error: unknown type name 'IsoSpec'
Spectrum::Spectrum(IsoSpec& iso, FunctionalKernel& kernel, double _bucketsize)
                   ^
1 warning and 2 errors generated.
../../IsoSpec++/test.cpp:7:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, const char ** argv)
             ^
../../IsoSpec++/test.cpp:7:34: warning: unused parameter 'argv' [-Wunused-parameter]
int main(int argc, const char ** argv)
                                 ^
2 warnings generated.
from_formula.cpp:6:11: error: use of undeclared identifier 'IsoSpec'
        auto i = IsoSpec::IsoFromFormula(argv[1], atof(argv[2]));
                 ^
from_formula.cpp:4:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char** argv)
             ^
1 warning and 1 error generated.
Makefile:15: recipe for target 'testcc' failed
make: *** [testcc] Error 1
hroest commented 5 years ago

I found similar issues with hard-coded paths in other tests:

hr@hr-Precision-5520:~/projects/IsoSpec/tests/C++$ make IsoThresholdGenerator 
clang++ -std=c++11 IsoThresholdGenerator.cpp -o IsoThresholdGenerator
IsoThresholdGenerator.cpp:2:10: fatal error: '/Users/matteo/Documents/IsoSpec/IsoSpec/IsoSpec++/unity-build.cpp' file not found
#include "/Users/matteo/Documents/IsoSpec/IsoSpec/IsoSpec++/unity-build.cpp"
         ^
1 error generated.
Makefile:46: recipe for target 'IsoThresholdGenerator' failed
make: *** [IsoThresholdGenerator] Error 1
hr@hr-Precision-5520:~/projects/IsoSpec/tests/C++$ make tabulator 
clang++ -std=c++11 ../../IsoSpec++/unity-build.cpp tabulator_test.cpp -o tabulator
tabulator_test.cpp:2:10: fatal error: '/Users/matteo/Documents/IsoSpec/IsoSpec/IsoSpec++/unity-build.cpp' file not found
#include "/Users/matteo/Documents/IsoSpec/IsoSpec/IsoSpec++/unity-build.cpp"
         ^
1 error generated.
Makefile:40: recipe for target 'tabulator' failed
make: *** [tabulator] Error 1
michalsta commented 5 years ago

Yeah, the tests and examples are a bit lagging behind the main code base: they are mostly for the 1.0.X version, while the main repo is pushing for 1.9.0. I'll try to remedy that before the weekend.

michalsta commented 5 years ago

Right. We have finalized the 1.9.0 release and everything (except the R stuff) should be working and at least moderately documented.