|
allegro and fstream errors |
Frank Drebin
Member #2,987
December 2002
|
as the topic says if i include <fstream> and <allegro.h> i get a lot of errors. cbot.cpp:26: error: use of 'fixed' is ambiguous /usr/include/allegro/fixed.h:28: error: first declared as 'typedef int32_t fixed' here /usr/lib/gcc/i686-pc-linux-gnu/4.0.3/../../../../include/c++/4.0.3/bits/ios_base.h:951: error: also declared as 'std::ios_base& std::fixed(std::ios_base&)' here ... what to do now? |
CGamesPlay
Member #2,559
July 2002
|
Show us the line with the error. -- Ryan Patterson - <http://cgamesplay.com/> |
Frank Drebin
Member #2,987
December 2002
|
|
Matthew Leverton
Supreme Loser
January 1999
|
Do you happen to have a using namespace in your headers? |
Carrus85
Member #2,633
August 2002
|
Yes, do NOT do using namespace std if you are going to be using fixed. (Since std::fixed is a stream manipulator, you will end up with (std::)fixed and fixed in your namespace).
|
Indeterminatus
Member #737
November 2000
|
_______________________________ |
Frank Drebin
Member #2,987
December 2002
|
Quote: Do you happen to have a using namespace in your headers? No! Quote: ::fixed distance=itofix(1000);
this works but is this really the only way? |
CGamesPlay
Member #2,559
July 2002
|
It tells the compiler to use the version of fixed not in any namespace--the one on the global scope. -- Ryan Patterson - <http://cgamesplay.com/> |
Frank Drebin
Member #2,987
December 2002
|
so there isn't an workaround for this? |
CGamesPlay
Member #2,559
July 2002
|
Nobody uses fixeds And the workaround is not to use using namespace std;. This is the reason namespaces exist. -- Ryan Patterson - <http://cgamesplay.com/> |
Frank Drebin
Member #2,987
December 2002
|
you mean to use the :: (scope-operator), heh? |
Indeterminatus
Member #737
November 2000
|
Quote: there is no such thing like a namespace allegro, right? Right. And as for the workaround: If you don't want to use ::, and you also don't want to write std:: everywhere, instead of using namespace std; you can put using std::vector; for example (of course, you'd have to do that for everything you're using from the std namespace). As long as you don't write using std::fixed; then, fixed isn't ambiguous, hence you won't need to explicitly identify which one you want. _______________________________ |
Frank Drebin
Member #2,987
December 2002
|
ok thanks |
|