keith.briggs@bt.com wrote:
I am using g++ 3.2 on a redhat linux system. I took the johnson_all_pairs_shortest_paths example, (http://www.boost.org/libs/graph/example/johnson-eg.cpp) which works fine, but then changed const int V = 5; to const int V = n; where n has been computed at runtime. This should not change the type of V or D, but I now get the error below. Can anyone explain how to fix this? Thanks, Keith
/usr/bin/g++ -I ~/boost_1_32_0/ graph_stats.cc graph_stats.cc: In function `int main()': graph_stats.cc:46: no matching function for call to ` johnson_all_pairs_shortest_paths(main()::Graph&, int[V][V], boost::bgl_named_params
)'
So, you get a code like: const int V = n; int D[V][V]; In this case, 'V' is not a compile time constant and the second line is not valid -- array bounds must be compile time constant. I have no idea why you get the error you get, instead of error right at the point where array is declared. Most likely, this is diagnostic problem in the rather ancient (;-)) version of gcc that you're using. - Volodya