Author Topic: Strange local_facets Error...  (Read 4771 times)

Corndog

  • Guest
Strange local_facets Error...
« on: October 18, 2006, 01:29:42 am »
Hello.

I started on a school project a few weeks ago on Artificial Intelligence. I have a Linux/Windows dual-boot and have been developing with Code::Blocks on both platforms.

A few days ago, when I tried it on Windows, the compiler gave me this strange error:


mingw32-g++.exe -L"C:\Program Files\CodeBlocks\lib"  -o .\Linear4.exe obj\Debug\main.o obj\Debug\Linear4.o   
obj\Debug\Linear4.o: In function `ZN3triC1Ei':
K:/Programming/Science/Linear4/Linear4.cpp:(.bss+0x0): multiple definition of `data::board'
obj\Debug\main.o:C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/locale_facets.tcc:2497: first defined here
obj\Debug\Linear4.o: In function `ZN3triC1Ei':
K:/Programming/Science/Linear4/Linear4.cpp:(.bss+0x40): multiple definition of `data::fake'
obj\Debug\main.o:C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/locale_facets.tcc:2506: first defined here


First, I've never included local_facets. Also, the .o extension is the Linux .dll equivilent, right? So why is it in my Windows? I use the same external harddrive for both platforms, and I'm thinking this has something to do with it. I can't get rid of the .o files though. I've rebuilt, cleaned, and everything else. I haven't tried it on Linux for a while, but I don't think it was working either.

Here's my specs:
Windows XP MCE with C::B Nightly 10/17/06
Suse Linux 10.1 with C::B RC2
64-bit Athlon 4200+ (dual core)

I'm thinking it has something to do with the shared harddrive, but wanted to see what you guys thought (with your infinitely superior programming knowledge).

Well, thanks for your time!

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: Strange local_facets Error...
« Reply #1 on: October 18, 2006, 01:42:22 am »
.o is the extension gcc gives object files

as for the error, maybe you defined data::board and data::fake in Linear4.cpp instead of declaring it extern?

also, it seems like mingw uses those variables in one of it's files, which is likely included from one of the standard headers.

[edit]
it's included from <locale>
[/edit]
« Last Edit: October 18, 2006, 01:56:20 am by kidmosey »
3 years until google knows more than god.

Corndog

  • Guest
Re: Strange local_facets Error...
« Reply #2 on: October 18, 2006, 02:14:36 am »
First off, thanks for the quick reply.

Quote
.o is the extension gcc gives object files
Oh. Makes sense...Wow, I'm slow today...

Quote
as for the error, maybe you defined data::board and data::fake in Linear4.cpp instead of declaring it extern?
Nope, both defined in the header.

Quote
also, it seems like mingw uses those variables in one of it's files, which is likely included from one of the standard headers.
I changed the names of them, and it said the same thing. Anything I try gives me the same error

Quote
it's included from <locale>
Hmmm...that's weird. The only standard headers I'm including are iostream and string.

Thanks, though.

Oh, the weird name is because it's a Connect4 program, and I wanted to make it sound different...and the dorkish Linear4's all I came up with. Oh well....I'm not graded on creativity...

Offline kidmosey

  • Multiple posting newcomer
  • *
  • Posts: 95
    • MUSITU International
Re: Strange local_facets Error...
« Reply #3 on: October 18, 2006, 05:38:49 am »
Hard to say, then.  I don't find any references to those variables anywhere.

Best guess, again, is to make sure your header is only predeclaring variables instead of defining them.

I don't see multiple drives causing any problems, since I am currently using C::B on one drive and keeping my projects on another.
3 years until google knows more than god.

Corndog

  • Guest
Re: Strange local_facets Error...
« Reply #4 on: October 20, 2006, 04:11:49 am »
Apparently, I'm the only person in America who has ever had this problem...Google turns up nothing. Or maybe I'm not searching hard enough.

I've tried lots of things, and haven't narrowed down the problem yet. I'll try reinstalling C::B and GCC soon, but I doubt it will make any difference. locale_facets doesn't even have anything on the lines that it says--nothing relevant to me, anyways. Just a brace on 2497, and

for (size_t __j = 0; __j < __min && __test; --__i, ++__j)

on line 2506.

Another thing I noticed. When I go to build, C::B freezes for a few seconds, and gives me the white screen that's trademark of a non-responsive window. Then, everything comes back, including the error. I haven't searched the forums for this yet, so forgive me if it's been answered a thousand times, but it might be the piece of info you need to diagnose this.

Thanks again.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Strange local_facets Error...
« Reply #5 on: October 20, 2006, 04:24:34 am »
Try rebuilding your project with GCC 4.0.3 or 4.1.1 (check my signature). I had some weird redefinition too trying to use locales with 3.4.x, so it could be related.