Question: I have an MSSQL server and a function that return table value. I want to use it in my Grails application. Is there any straight way to do this?

For now I come to using an SQL query. Here code from controller

```
final curSession = sessionFactory.currentSession
final String query = 'SELECT * FROM [dbo].[someFunction] (params here)'
final sqlQuery = curSession.createSQLQuery(query)
//sqlQuery.addEntity(oot.Foo.class)
final List<FooCommand> results = sqlQuery.list()
[results:results]

```

If I do so I receive Array of Arrays in a view without any names of columns and it's not too convinient to operate with it.
If I create a **domain class** Foo that match select and uncomment the line `sqlQuery.addEntity(Foo.class)` I'll get exactly what I want, but in this case grails will create empty table `dbo.foo` which I would like to avoid.

I found that there are **Command Objects** in Grails which almost like domain but do not create underlying tables. Sounds like what I want. But when I use Command class instead Domain (`sqlQuery.addEntity(oot.FooCommand.class)`) I receive a **MappingException**

```
Unknown entity: oot.FooCommand. Stacktrace follows:
Message: Unknown entity: oot.FooCommand

```

Answer: 
I met the same issue when built openCV libraries

```
$ gcc DisplayImage.cpp `pkg-config opencv --libs --cflags` -o DisplayImage
/usr/bin/ld: /tmp/ccbyJ7Ms.o: undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@@GLIBCXX_3.4.21'
//usr/lib/i386-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

```

**[SOLVE]**

For **gcc** try adding `-lstdc++` to your command. 

```
$ gcc DisplayImage.cpp `pkg-config opencv --libs --cflags` -o DisplayImage -lstdc++

```

For **g++** it will link **libstdc.so.6++** automatically

```
$ g++ DisplayImage.cpp `pkg-config opencv --libs --cflags` -o DisplayImage

```
I had same problem it was solved by addiing -lstdc++ in command line.