Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile the SGB examples. #87

Merged
merged 1 commit into from
May 27, 2017
Merged

Compile the SGB examples. #87

merged 1 commit into from
May 27, 2017

Conversation

ascherer
Copy link
Contributor

@ascherer ascherer commented Mar 19, 2017

System: (K)Ubuntu 16.04 LTS
Compiler: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Try to g++ -c --std=c++14 the four BGL–SGB examples girth.cpp, miles_span.cpp, roget_components.cpp, and topo-sort-with-sgb.cpp. This leads to numerous errors.

Applied fixes

  1. SGB 2002-01-30 changed the “Associated Press scores” from ap0 and ap1 to ap. This preprocessor macro (sic!) collides with numerous function parameters in named_function_params.hpp. #undefining the macro doesn't break the BGL–SGB examples.

  2. girth.cpp fails because of a missing null_vertex() function. Added to the header templates.

  3. roget_components.cpp invokes strncmp() from the C library. #include added.

  4. topo-sort-with-sgb.cpp hickups because of a missing vertices() function. Following roget_components.cpp and putting the collective SGB header up front fixes this.

Results

With my local installation of the Stanford GraphBase, all four example programs compile and link fine with the commandline (from the example/ subdirectory)

for example in girth miles_span roget_components topo-sort-with-sgb
do
    g++ --std=c++14 -I../include -I/usr/include/sgb $example.cpp -o $example -lgb -L/usr/lib/sgb
done

The resulting executables produce the expected outputs.

System: (K)Ubuntu 16.04 LTS
Compiler: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

Try to 'g++ -c' the four SGB examples girth.cpp, miles_span.cpp,
roget_components.cpp, and topo-sort-with-sgb.cpp.

(1) SGB 2002-01-30 changed the 'Associated Press scores' from 'ap0' and
'ap1' to 'ap'. This preprocessor macro (sic!) collides with numerous
function parameters in 'named_function_params.hpp'. '#undef'ining the
macro doesn't break the BGL examples.

(2) girth.cpp fails because of a missing 'null_vertex()' function.

(3) roget_components.cpp invokes 'strncmp()' from the C library.

(4) topo-sort-with-sgb.cpp hickups because of a missing 'vertices()'
function. Following roget_components.cpp and putting the collective
SGB header up front fixes this.
@Belcourt
Copy link
Member

Graph doesn't support C++14 at this time. We have numerous developers who still need C++98 so we're slowing moving forward to C++11. We're looking for migration paths to newer compilers without losing legacy codes and developers, finding the right balance is difficult.

@ascherer
Copy link
Contributor Author

Well, the problems already occur without the --std=c++14 option and can be fixed for older compilers just the same way.

@Belcourt Belcourt merged commit 74115a2 into boostorg:develop May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants