This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Compile error

Tags: None
(comma "," separated)
marklevy
Registered Member
Posts
6
Karma
0
OS

Compile error

Fri May 20, 2011 6:22 pm
I am new to Eigen. Our software vendor has sent us their latest update (that includes Eigen) and I am supposed to try to build it in the QNX Momentics IDE. I do not have much information about the paths and any symbols that have to be defined as compiler arguments.

I am getting an error: "error: there are no arguments to 'log2' that depend on a template parameter, so a declaration of 'log2' must be available" from MatrixExponential.h.

Any clues?

Thanks in advance.
jitseniesen
Registered Member
Posts
204
Karma
2

Re: Compile error

Fri May 20, 2011 8:37 pm
I guess this means that your environment does not define the log2() function. Your IDE would not be alone in this; Visual Studio does not define it either even though it is included in some standard. If this is indeed the issue, then try activating the definition of log2() at the start of MatrixExponential.h inside the #ifdef _MSC_VER ... #endif
marklevy
Registered Member
Posts
6
Karma
0
OS

Re: Compile error

Fri May 20, 2011 9:24 pm
That is very interesting. MatrixExpoential.h does define log2() inside the #ifdef _MSC_VER ... #endif block, but it is not seeing _MSC_VER defined!

(This is the kind of problem I've been experiencing. One header needs something from another header that needs another header and so on.)

Where is _MSC_VER supposed to be defined?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Compile error

Sat May 21, 2011 5:46 am
_MSC_VER is defined by Visual Studio when you compile with it. You could replace the #ifdef _MSC_VER by:

#if defined(_MSC_VER) || defined(__QNXNTO__)

assuming that __QNXNTO__ is right token to detect your environment.
marklevy
Registered Member
Posts
6
Karma
0
OS

Re: Compile error

Mon May 23, 2011 3:37 pm
__QNXNTO__ appears to be correct, but the problem has not gone away. I now do have log2 defined, but I am still getting the original message:

"error: there are no arguments to 'log2' that depend on a template parameter, so a declaration of 'log2' must be available"

This is happening inside of the MatrixExponential.h header file, on a line that reads:
pade5(*m_M);

I don't see any references to 'log2' inside of pade5.

Any more clues?
marklevy
Registered Member
Posts
6
Karma
0
OS

Re: Compile error

Mon May 23, 2011 3:53 pm
NO, WAIT. I had the wrong header file inside my IDE. Nuts.

Now the log2 message is gone, but I am getting the same message for the "ceil" call.

It is properly defined as far as I can tell.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Compile error

Mon May 23, 2011 5:17 pm
hm that's very strange, I admit that log2 is not part of the standard but ceil really is. Are you using a standard scalar type?
marklevy
Registered Member
Posts
6
Karma
0
OS

Re: Compile error

Mon May 23, 2011 5:29 pm
As far as I can tell, everything is very much standard.

However, a Google search on the error came up with an article that indicates this is an issue with gcc, version 4.x.

http://www.agapow.net/programming/cpp/n ... -parameter

http://docs.redhat.com/docs/en-US/Red_H ... dings.html

I am doing a little more research.
marklevy
Registered Member
Posts
6
Karma
0
OS

Re: Compile error

Mon May 23, 2011 5:55 pm
Hey, ggael, you gave me a really good tip, slthough you may not have known it. When you said that ceil was part of the standard, I realized that the line showing the error --

m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));

has "std::" on the max call, but not ceil. I added the std class to ceil and the error is fixed.

I still do not completely understand, but you might want to add this to the next release.


Thank you for your help. I will likely have to ask more questions as I continue this process.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Compile error

Tue May 24, 2011 7:51 pm
ok thanks for your finding! I admit I did not looked at the problematic source file....


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar