User forums > General (but related to Code::Blocks)

GCC 4.4.0-tdm-1 for MinGW (with installer)

<< < (6/11) > >>

drac:

--- Quote ---c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
c:\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared

--- End quote ---

You need to patch the cwchar header, others have done it http://www.nabble.com/-ANN--GCC-4.4.0-Released-td23207147.html

With that patch you can compile this new C++0x hello program (g++ hello.cpp -o hello.exe -std=c++0x)


--- Code: ---#include <iostream>
#include <vector>

int main()
{
  std::vector<char> v = {
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x43, 0x2b,
0x2b, 0x30, 0x78, 0x20, 0x57, 0x6f, 0x72, 0x6c,
0x64, 0x21 };
 
  for (auto it = v.begin(); it != v.end(); ++it)
  {
    std::cout << *it;
  }
 
  std::cout << std::endl;
}
--- End code ---

C++0x is cool!

killerbot:
I can confirm Thomas' suggestion works :-)

So I now have among the previously working options :
  -std=c98++ -ansi -U__STRICT_ANSI__

What will be the real difference, with this being undefined, with respect to ensuring portable codes and very little extensions creeping in from gcc ?

How save is the workaround of just commenting out the 2 offending lines ? Is this something that will make it in the official (mingw)-gcc ??

TDragon:
Rather than commenting out the two lines in cwchar, surround them with #ifndef __STRICT_ANSI__/#endif. This is actually the correct fix for the problem, which I believe is merely a small oversight. This issue should be discussed with the mingw-runtime maintainer and then forwarded to GCC (probably Danny Smith).

sahasranaman:
I have been trying this for some time. I installed from the latest bundled installer, then I've got the new -2 packages seperately, still I keep getting the error. By the way, I'm linking with libsigc++, which was actually built using MinGW GCC 3.4.5. I'm pasting the error. Could someone help?


--- Code: ---g++.exe -o dist/Debug/MinGW-Windows/urllib__ build/Debug/MinGW-Windows/urllibpp.o build/Debug/MinGW-Windows/main.o -L/C/Python26/libs -L/C/msys/1.0/local/lib -L../gtk+/lib -L/c/mingw/lib/gcc/mingw32/4.4.0 -lglibmm-2.4.dll -lpython26 -lboost_python-mgw44-mt-1_38 -lsigc-2.0 -lglib-2.0.dll
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Unregister':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:189: multiple definition of `_Unwind_SjLj_Unregister'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000019.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Register':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind-sjlj.c:142: multiple definition of `_Unwind_SjLj_Register'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000016.o):(.text+0x0): first defined here
c:/mingw/lib/gcc/mingw32/4.4.0/libgcc_eh.a(unwind-sjlj.o): In function `Unwind_SjLj_Resume':
d:\crossdev\b4.4.0-tdm-1\mingw32\libgcc/../../../gcc-4.4.0/libgcc/../gcc/unwind.inc:220: multiple definition of `_Unwind_SjLj_Resume'
c:/msys/1.0/local/lib/libsigc-2.0.dll.a(d000017.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status

--- End code ---

TDragon:
Seems like libsigc-2.0.dll.a was actually built with the first release of 4.4.0-tdm-1, or some other build that doesn't properly hide the _Unwind_* symbols. Whatever the case, it needs to be rebuilt, preferably with 4.4.0-tdm-1 r2.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version