Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #6719 > unrolled thread
| Started by | Paul <pepstein5@gmail.com> |
|---|---|
| First post | 2016-07-17 09:43 -0700 |
| Last post | 2016-07-18 09:05 -0700 |
| Articles | 10 — 3 participants |
Back to article view | Back to comp.programming
Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 09:43 -0700
Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-17 17:15 +0000
Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 11:32 -0700
Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 00:12 +0000
Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 23:53 -0700
Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 14:24 +0000
Re: Feedback on sudoku solver and count-the-squares solver? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 17:02 +0100
Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 16:51 +0000
Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-18 09:03 -0700
Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-18 09:05 -0700
| From | Paul <pepstein5@gmail.com> |
|---|---|
| Date | 2016-07-17 09:43 -0700 |
| Subject | Feedback on sudoku solver and count-the-squares solver? |
| Message-ID | <bc6924b2-51f3-476d-b06c-2c235de57086@googlegroups.com> |
I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example. Any feedback would be welcome. Thanks, Paul
[toc] | [next] | [standalone]
| From | root <NoEMail@home.org> |
|---|---|
| Date | 2016-07-17 17:15 +0000 |
| Message-ID | <nmgeg3$34q$1@news.albasani.net> |
| In reply to | #6719 |
Paul <pepstein5@gmail.com> wrote: > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp > > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example. > > Any feedback would be welcome. > > Thanks, > > Paul Feedback: your sudoku solver will not compile using gcc 5.3.0
[toc] | [prev] | [next] | [standalone]
| From | Paul <pepstein5@gmail.com> |
|---|---|
| Date | 2016-07-17 11:32 -0700 |
| Message-ID | <eddf769d-f966-4f0a-a2ff-69caddb64d91@googlegroups.com> |
| In reply to | #6721 |
On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote: > Paul <pepstein5@gmail.com> wrote: > > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp > > > > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example. > > > > Any feedback would be welcome. > > > > Thanks, > > > > Paul > > Feedback: your sudoku solver will not compile using gcc 5.3.0 Do you have C++11 enabled? Paul
[toc] | [prev] | [next] | [standalone]
| From | root <NoEMail@home.org> |
|---|---|
| Date | 2016-07-18 00:12 +0000 |
| Message-ID | <nmh6tr$2l5$1@news.albasani.net> |
| In reply to | #6722 |
Paul <pepstein5@gmail.com> wrote: > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote: >> Paul <pepstein5@gmail.com> wrote: >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp >> > >> > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example. >> > >> > Any feedback would be welcome. >> > >> > Thanks, >> > >> > Paul >> >> Feedback: your sudoku solver will not compile using gcc 5.3.0 > > Do you have C++11 enabled? > > Paul I have c++14
[toc] | [prev] | [next] | [standalone]
| From | Paul <pepstein5@gmail.com> |
|---|---|
| Date | 2016-07-17 23:53 -0700 |
| Message-ID | <9a5c4ff5-a322-4c84-94f7-e7b2a10b9d0a@googlegroups.com> |
| In reply to | #6726 |
On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote: > Paul <pepstein5@gmail.com> wrote: > > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote: > >> Paul <pepstein5@gmail.com> wrote: > >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp > >> > > >> > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example. > >> > > >> > Any feedback would be welcome. > >> > > >> > Thanks, > >> > > >> > Paul > >> > >> Feedback: your sudoku solver will not compile using gcc 5.3.0 > > > > Do you have C++11 enabled? > > > > Paul > > I have c++14 What error message do you get? Paul
[toc] | [prev] | [next] | [standalone]
| From | root <NoEMail@home.org> |
|---|---|
| Date | 2016-07-18 14:24 +0000 |
| Message-ID | <nmioqo$9rr$2@news.albasani.net> |
| In reply to | #6729 |
Paul <pepstein5@gmail.com> wrote:
> On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote:
>> Paul <pepstein5@gmail.com> wrote:
>> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote:
>> >> Paul <pepstein5@gmail.com> wrote:
>> >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp
>> >> >
>> >> > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example.
>> >> >
>> >> > Any feedback would be welcome.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Paul
>> >>
>> >> Feedback: your sudoku solver will not compile using gcc 5.3.0
>> >
>> > Do you have C++11 enabled?
>> >
>> > Paul
>>
>> I have c++14
>
> What error message do you get?
>
> Paul
I,m sorry Paul, but there were 302 lines of error messages. Here is a sample:
In file included from /usr/include/c++/5.3.0/unordered_map:35:0,
from sudokusolver.cpp:12:
/usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 c #error This file requires compiler and library support for the \
^
sudokusolver.cpp:137:115: error: 'std::unordered_map' has not been declared
bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
^
sudokusolver.cpp:137:128: error: expected ',' or '...' before '<' token
bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
^
sudokusolver.cpp: In function 'bool consistent(int, const std::pair<int, int>&, const std::vector<std::vector<int> >&, int)':
sudokusolver.cpp:139:7: error: 'column' does not name a type
auto column = record[digit];
^
sudokusolver.cpp:140:21: error: 'column' was not declared in this scope
for(int i = 0; i < column.size(); ++i)
^
sudokusolver.cpp:141:38: error: 'subgridSize' was not declared in this scope
if(!consistent(location, column[i], subgridSize))
^
sudokusolver.cpp: In function 'std::vector<std::vector<int> > createTestGrid()':
sudokusolver.cpp:178:61: error: in C++98 'grid' must be initialized by constructor, not by '{...}'
{0,0,1,0,0,0,0,6,8},{0,0,8,5,0,0,0,1,0},{0,9,0,0,0,0,4,0,0}};
^
sudokusolver.cpp:178:61: error: could not convert '{{8, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 3, 6, 0, 0, 0, 0, 0}, {0, 7, 0, 0, 9, 0, 2, 0, 0}, {0, 5, 0, 0, 0, 7, 0, 0, 0}, {0, 0, 0, 0, 4, 5, 7, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 3, 0}, {0, 0, 1, 0, 0sudokusolver.cpp: At global scope:
sudokusolver.cpp:230:7: error: 'unordered_map' in namespace 'std' does not name a template type
std::unordered_map<int, std::vector<std::pair<int, int> > >occurrences(const std::vector<std::vector<int> >& grid)
^
sudokusolver.cpp:257:107: error: 'std::unordered_map' has not been declared
std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
^
sudokusolver.cpp:257:120: error: expected ',' or '...' before '<' token
std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
^
sudokusolver.cpp: In function 'std::vector<int> options(const std::pair<int, int>&, std::vector<std::vector<int> >&, int)':
sudokusolver.cpp:268:37: error: 'record' was not declared in this scope
if(consistent(val, location, grid, record, subgridSize))
^
sudokusolver.cpp:268:45: error: 'subgridSize' was not declared in this scope
if(consistent(val, location, grid, record, subgridSize))
^
sudokusolver.cpp: At global scope:
sudokusolver.cpp:283:133: error: 'std::unordered_map' has not been declared
std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
^
sudokusolver.cpp:283:146: error: expected ',' or '...' before '<' token
std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
^
sudokusolver.cpp: In function 'std::list<std::pair<int, int> >::iterator min(std::vector<std::vector<int> >&, std::list<std::pair<int, int> >&, int)':
sudokusolver.cpp:286:7: error: 'iter' does not name a type
auto iter = blanks.begin();
^
sudokusolver.cpp:287:7: error: 'currentMin' does not name a type
auto currentMin = iter;
^
sudokusolver.cpp:288:8: error: 'iter' was not declared in this scope
My command line was:
gcc sudokusolver.cpp -o sudokusolver
I am running Slackware64-multilib 14.2
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-07-18 17:02 +0100 |
| Message-ID | <878twzhr2y.fsf@bsb.me.uk> |
| In reply to | #6735 |
root <NoEMail@home.org> writes: > Paul <pepstein5@gmail.com> wrote: >> On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote: >>> Paul <pepstein5@gmail.com> wrote: >>> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote: >>> >> Paul <pepstein5@gmail.com> wrote: >>> >> > I have a sudoku solver in c++ here -- >>> >> > https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp >>> >> > >>> >> > and I also have code for solving "count the squares" problems. >>> >> > This is solved and tested here: >>> >> > https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp >>> >> > However, most of the lines of code involve setting up the >>> >> > example. >>> >> > >>> >> > Any feedback would be welcome. >>> >> > >>> >> > Thanks, >>> >> > >>> >> > Paul >>> >> >>> >> Feedback: your sudoku solver will not compile using gcc 5.3.0 >>> > >>> > Do you have C++11 enabled? >>> > >>> > Paul >>> >>> I have c++14 But not enabled. >> What error message do you get? > > I,m sorry Paul, but there were 302 lines of error messages. Here is a sample: > In file included from /usr/include/c++/5.3.0/unordered_map:35:0, > from sudokusolver.cpp:12: > /usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This > file requires compiler and library support for the ISO C++ 2011 > standard. This support is currently experimental, and must be enabled > with the -std=c++11 or -std=gnu++11 ... <snip> > My command line was: > gcc sudokusolver.cpp -o sudokusolver try g++ -std=c++11 sudokusolver.cpp -o sudokusolver -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | root <NoEMail@home.org> |
|---|---|
| Date | 2016-07-18 16:51 +0000 |
| Message-ID | <nmj1f6$snq$1@news.albasani.net> |
| In reply to | #6745 |
Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > root <NoEMail@home.org> writes: > >> Paul <pepstein5@gmail.com> wrote: >>> On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote: >>>> Paul <pepstein5@gmail.com> wrote: >>>> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote: >>>> >> Paul <pepstein5@gmail.com> wrote: >>>> >> > I have a sudoku solver in c++ here -- >>>> >> > https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp >>>> >> > >>>> >> > and I also have code for solving "count the squares" problems. >>>> >> > This is solved and tested here: >>>> >> > https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp >>>> >> > However, most of the lines of code involve setting up the >>>> >> > example. >>>> >> > >>>> >> > Any feedback would be welcome. >>>> >> > >>>> >> > Thanks, >>>> >> > >>>> >> > Paul >>>> >> >>>> >> Feedback: your sudoku solver will not compile using gcc 5.3.0 >>>> > >>>> > Do you have C++11 enabled? >>>> > >>>> > Paul >>>> >>>> I have c++14 > > But not enabled. > >>> What error message do you get? >> >> I,m sorry Paul, but there were 302 lines of error messages. Here is a sample: >> In file included from /usr/include/c++/5.3.0/unordered_map:35:0, >> from sudokusolver.cpp:12: >> /usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This >> file requires compiler and library support for the ISO C++ 2011 >> standard. This support is currently experimental, and must be enabled >> with the -std=c++11 or -std=gnu++11 ... > ><snip> >> My command line was: >> gcc sudokusolver.cpp -o sudokusolver > > try > > g++ -std=c++11 sudokusolver.cpp -o sudokusolver > That worked.
[toc] | [prev] | [next] | [standalone]
| From | Paul <pepstein5@gmail.com> |
|---|---|
| Date | 2016-07-18 09:03 -0700 |
| Message-ID | <6cce9a07-6747-47d8-9cc3-c1e36bee6d86@googlegroups.com> |
| In reply to | #6735 |
On Monday, July 18, 2016 at 3:24:27 PM UTC+1, root wrote:
> Paul <pepstein5@gmail.com> wrote:
> > On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote:
> >> Paul <pepstein5@gmail.com> wrote:
> >> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote:
> >> >> Paul <pepstein5@gmail.com> wrote:
> >> >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp
> >> >> >
> >> >> > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example.
> >> >> >
> >> >> > Any feedback would be welcome.
> >> >> >
> >> >> > Thanks,
> >> >> >
> >> >> > Paul
> >> >>
> >> >> Feedback: your sudoku solver will not compile using gcc 5.3.0
> >> >
> >> > Do you have C++11 enabled?
> >> >
> >> > Paul
> >>
> >> I have c++14
> >
> > What error message do you get?
> >
> > Paul
>
> I,m sorry Paul, but there were 302 lines of error messages. Here is a sample:
> In file included from /usr/include/c++/5.3.0/unordered_map:35:0,
> from sudokusolver.cpp:12:
> /usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 c #error This file requires compiler and library support for the \
> ^
> sudokusolver.cpp:137:115: error: 'std::unordered_map' has not been declared
> bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> ^
> sudokusolver.cpp:137:128: error: expected ',' or '...' before '<' token
> bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> ^
> sudokusolver.cpp: In function 'bool consistent(int, const std::pair<int, int>&, const std::vector<std::vector<int> >&, int)':
> sudokusolver.cpp:139:7: error: 'column' does not name a type
> auto column = record[digit];
> ^
> sudokusolver.cpp:140:21: error: 'column' was not declared in this scope
> for(int i = 0; i < column.size(); ++i)
> ^
> sudokusolver.cpp:141:38: error: 'subgridSize' was not declared in this scope
> if(!consistent(location, column[i], subgridSize))
> ^
> sudokusolver.cpp: In function 'std::vector<std::vector<int> > createTestGrid()':
> sudokusolver.cpp:178:61: error: in C++98 'grid' must be initialized by constructor, not by '{...}'
> {0,0,1,0,0,0,0,6,8},{0,0,8,5,0,0,0,1,0},{0,9,0,0,0,0,4,0,0}};
> ^
> sudokusolver.cpp:178:61: error: could not convert '{{8, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 3, 6, 0, 0, 0, 0, 0}, {0, 7, 0, 0, 9, 0, 2, 0, 0}, {0, 5, 0, 0, 0, 7, 0, 0, 0}, {0, 0, 0, 0, 4, 5, 7, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 3, 0}, {0, 0, 1, 0, 0sudokusolver.cpp: At global scope:
> sudokusolver.cpp:230:7: error: 'unordered_map' in namespace 'std' does not name a template type
> std::unordered_map<int, std::vector<std::pair<int, int> > >occurrences(const std::vector<std::vector<int> >& grid)
> ^
> sudokusolver.cpp:257:107: error: 'std::unordered_map' has not been declared
> std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> ^
> sudokusolver.cpp:257:120: error: expected ',' or '...' before '<' token
> std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> ^
> sudokusolver.cpp: In function 'std::vector<int> options(const std::pair<int, int>&, std::vector<std::vector<int> >&, int)':
> sudokusolver.cpp:268:37: error: 'record' was not declared in this scope
> if(consistent(val, location, grid, record, subgridSize))
> ^
> sudokusolver.cpp:268:45: error: 'subgridSize' was not declared in this scope
> if(consistent(val, location, grid, record, subgridSize))
> ^
> sudokusolver.cpp: At global scope:
> sudokusolver.cpp:283:133: error: 'std::unordered_map' has not been declared
> std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
> ^
> sudokusolver.cpp:283:146: error: expected ',' or '...' before '<' token
> std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
> ^
> sudokusolver.cpp: In function 'std::list<std::pair<int, int> >::iterator min(std::vector<std::vector<int> >&, std::list<std::pair<int, int> >&, int)':
> sudokusolver.cpp:286:7: error: 'iter' does not name a type
> auto iter = blanks.begin();
> ^
> sudokusolver.cpp:287:7: error: 'currentMin' does not name a type
> auto currentMin = iter;
> ^
> sudokusolver.cpp:288:8: error: 'iter' was not declared in this scope
>
>
>
> My command line was:
> gcc sudokusolver.cpp -o sudokusolver
>
> I am running Slackware64-multilib 14.2
Thanks. The problem is that your compiler settings don't enable c++ 11. That is clearly explained in the error messages. I disabled c++ 11 on my IDE and got the same error messages as you.
Paul
[toc] | [prev] | [next] | [standalone]
| From | Paul <pepstein5@gmail.com> |
|---|---|
| Date | 2016-07-18 09:05 -0700 |
| Message-ID | <9c908dd8-f46e-46eb-bdb6-d61dbfa29220@googlegroups.com> |
| In reply to | #6746 |
On Monday, July 18, 2016 at 5:03:37 PM UTC+1, Paul wrote:
> On Monday, July 18, 2016 at 3:24:27 PM UTC+1, root wrote:
> > Paul <pepstein5@gmail.com> wrote:
> > > On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote:
> > >> Paul <pepstein5@gmail.com> wrote:
> > >> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote:
> > >> >> Paul <pepstein5@gmail.com> wrote:
> > >> >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp
> > >> >> >
> > >> >> > and I also have code for solving "count the squares" problems. This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp However, most of the lines of code involve setting up the example.
> > >> >> >
> > >> >> > Any feedback would be welcome.
> > >> >> >
> > >> >> > Thanks,
> > >> >> >
> > >> >> > Paul
> > >> >>
> > >> >> Feedback: your sudoku solver will not compile using gcc 5.3.0
> > >> >
> > >> > Do you have C++11 enabled?
> > >> >
> > >> > Paul
> > >>
> > >> I have c++14
> > >
> > > What error message do you get?
> > >
> > > Paul
> >
> > I,m sorry Paul, but there were 302 lines of error messages. Here is a sample:
> > In file included from /usr/include/c++/5.3.0/unordered_map:35:0,
> > from sudokusolver.cpp:12:
> > /usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 c #error This file requires compiler and library support for the \
> > ^
> > sudokusolver.cpp:137:115: error: 'std::unordered_map' has not been declared
> > bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> > ^
> > sudokusolver.cpp:137:128: error: expected ',' or '...' before '<' token
> > bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> > ^
> > sudokusolver.cpp: In function 'bool consistent(int, const std::pair<int, int>&, const std::vector<std::vector<int> >&, int)':
> > sudokusolver.cpp:139:7: error: 'column' does not name a type
> > auto column = record[digit];
> > ^
> > sudokusolver.cpp:140:21: error: 'column' was not declared in this scope
> > for(int i = 0; i < column.size(); ++i)
> > ^
> > sudokusolver.cpp:141:38: error: 'subgridSize' was not declared in this scope
> > if(!consistent(location, column[i], subgridSize))
> > ^
> > sudokusolver.cpp: In function 'std::vector<std::vector<int> > createTestGrid()':
> > sudokusolver.cpp:178:61: error: in C++98 'grid' must be initialized by constructor, not by '{...}'
> > {0,0,1,0,0,0,0,6,8},{0,0,8,5,0,0,0,1,0},{0,9,0,0,0,0,4,0,0}};
> > ^
> > sudokusolver.cpp:178:61: error: could not convert '{{8, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 3, 6, 0, 0, 0, 0, 0}, {0, 7, 0, 0, 9, 0, 2, 0, 0}, {0, 5, 0, 0, 0, 7, 0, 0, 0}, {0, 0, 0, 0, 4, 5, 7, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 3, 0}, {0, 0, 1, 0, 0sudokusolver.cpp: At global scope:
> > sudokusolver.cpp:230:7: error: 'unordered_map' in namespace 'std' does not name a template type
> > std::unordered_map<int, std::vector<std::pair<int, int> > >occurrences(const std::vector<std::vector<int> >& grid)
> > ^
> > sudokusolver.cpp:257:107: error: 'std::unordered_map' has not been declared
> > std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> > ^
> > sudokusolver.cpp:257:120: error: expected ',' or '...' before '<' token
> > std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
> > ^
> > sudokusolver.cpp: In function 'std::vector<int> options(const std::pair<int, int>&, std::vector<std::vector<int> >&, int)':
> > sudokusolver.cpp:268:37: error: 'record' was not declared in this scope
> > if(consistent(val, location, grid, record, subgridSize))
> > ^
> > sudokusolver.cpp:268:45: error: 'subgridSize' was not declared in this scope
> > if(consistent(val, location, grid, record, subgridSize))
> > ^
> > sudokusolver.cpp: At global scope:
> > sudokusolver.cpp:283:133: error: 'std::unordered_map' has not been declared
> > std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
> > ^
> > sudokusolver.cpp:283:146: error: expected ',' or '...' before '<' token
> > std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
> > ^
> > sudokusolver.cpp: In function 'std::list<std::pair<int, int> >::iterator min(std::vector<std::vector<int> >&, std::list<std::pair<int, int> >&, int)':
> > sudokusolver.cpp:286:7: error: 'iter' does not name a type
> > auto iter = blanks.begin();
> > ^
> > sudokusolver.cpp:287:7: error: 'currentMin' does not name a type
> > auto currentMin = iter;
> > ^
> > sudokusolver.cpp:288:8: error: 'iter' was not declared in this scope
> >
> >
> >
> > My command line was:
> > gcc sudokusolver.cpp -o sudokusolver
> >
> > I am running Slackware64-multilib 14.2
>
> Thanks. The problem is that your compiler settings don't enable c++ 11. That is clearly explained in the error messages. I disabled c++ 11 on my IDE and got the same error messages as you.
>
> Paul
Ben and I posted at almost exactly the same time. I didn't know about Ben's message which is why I basically repeated what he said. Hope this is resolved. And thanks a lot for your interest.
Paul
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web