error: '::swprintf' has not been declared

This is a discussion on error: '::swprintf' has not been declared within the Windows Programming forums, part of the Platform Specific Boards category; Hi. I was trying to compile an example program I found on (and copied straight off) Boost's getting started page ...

  1. #1
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286

    error: '::swprintf' has not been declared

    Hi. I was trying to compile an example program I found on (and copied straight off) Boost's getting started page, using MinGW's g++ and MSYS' make, when I got the following compiling result:

    Code:
    -*- mode: compilation; default-directory: "d:/Work/Programs/Test_programs/boost_test/" -*-
    Compilation started at Wed May 05 23:37:27
    
    make -k 
    g++ main.cpp -Wall -Wextra -pedantic -g -std=c++98 -IC:/Program1/boost_1_42_0  -lmingw32 -c #Create .o files
    In file included from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/bits/postypes.h:42,
                     from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iosfwd:42,
                     from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ios:39,
                     from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/ostream:40,
                     from c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/iterator:65,
                     from C:/Program1/boost_1_42_0/boost/detail/iterator.hpp:54,
                     from C:/Program1/boost_1_42_0/boost/iterator/iterator_traits.hpp:8,
                     from C:/Program1/boost_1_42_0/boost/indirect_reference.hpp:15,
                     from C:/Program1/boost_1_42_0/boost/lambda/detail/operator_return_type_traits.hpp:17,
                     from C:/Program1/boost_1_42_0/boost/lambda/lambda.hpp:23,
                     from main.cpp:7:
    c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:159: error: '::swprintf' has not been declared
    c:\program1\qt\2010.02.1\mingw\bin\../lib/gcc/mingw32/4.4.0/include/c++/cwchar:166: error: '::vswprintf' has not been declared
    make: *** [main.o] Error 1
    make: Target `all' not remade because of errors.
    
    Compilation exited abnormally with code 2 at Wed May 05 23:37:30
    "error: '::swprintf' has not been declared". What can cause this problem? Has anyone had the same or a similar problem before? Thanks in advance!

    -Kristofer
    Come on, you can do it! b( ~_')

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,621
    I had the same problem too. Probably this happens because your compiler doesn't support Unicode, therefore these function that use wchar_t aren't there! ( i don't know )
    Devoted my life to programming...

  3. #3
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286
    Then how should it be done? Maybe the example code calls some function that is not platform independent? At least the function seems to have been removed, moved, or renamed, when g++ was ported to Windows and MinGW.

    So my next question is then: if this problem can not be solved, while using the same code, is there some other code that does work which I can use as a minimal boost example, so I can see that boost has been configured in the right way on my computer? The reason I tried to compile the example code from the first time was to see if I had set Boost up correctly, before I started to use it.
    Come on, you can do it! b( ~_')

  4. #4
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286
    Sipher, were you possibly also trying to get boost working with mingw/g++ on windows?
    Come on, you can do it! b( ~_')

  5. #5
    Algorithm engineer
    Join Date
    Jun 2006
    Posts
    286
    The example code works fine with Visual Studio 2008, as expected. I think the problem in this case is that Boost and MinGW are not guaranteed too work together; see the beginning of Boost's Getting Started on Windows guide. I'm changing to Visual Studio.
    Come on, you can do it! b( ~_')

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. variables when declared inside or outside a function
    By jas_atwal in forum C Programming
    Replies: 6
    Last Post: 12-14-2007, 01:42 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. Nested loop frustration
    By caroundw5h in forum C Programming
    Replies: 14
    Last Post: 03-15-2004, 08:45 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21