Results 1 to 3 of 3

Thread: Compiling error C2061 with stdlib.h

  1. #1
    Join Date
    Sep 2014
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Compiling error C2061 with stdlib.h

    Hallo everyone!
    I'm very newbie to Qt, it is my second day...

    My scenario is Qt 4.8.4 with Qt Creator 2.5.2, Visual Studio 2010, Windows XP

    In my source code STL is used, the STL files are under C:\STL, so I added to .pro file the command:

    CONFIG += ../stl
    INCLUDEPATH +=../stl

    When I try to compile I got an error related with the stdlib.h (C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\stdlib.h)
    The error says: "C2061: syntax error : identifier '_CountofType'"

    Is this error due to some inconsistency on the scenario mentioned above?
    How to solve it?

    Thank you very much in advance!!!
    Alx

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Compiling error C2061 with stdlib.h

    Are you trying to compile code that contains something like this?

    Qt Code:
    1. #include "stdafx.h"
    2.  
    3. template < _CountofType, size_t _SizeOfArray>
    4. char (*__countof_helper( _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
    To copy to clipboard, switch view to plain text mode 

    (Which I found simply by googling "_CountofType". You could have done that too and found the solution to your problem).

    The template syntax is incorrect. It should read:

    Qt Code:
    1. #include "stdafx.h"
    2.  
    3. template < typename _CountofType, size_t _SizeOfArray>
    4. char (*__countof_helper( _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Compiling error C2061 with stdlib.h

    The CONFIG variable is for selecting selecting compiler and project settings en masse, not including or linking individual libraries. For that you use the INCLUDEPATH and LIBS variables.
    http://qt-project.org/doc/qt-4.8/qma...ce.html#config

    You should be able to use STL with MSVC 2010 without any special configuration at all.

Similar Threads

  1. Error compiling vlc
    By arborges in forum Newbie
    Replies: 1
    Last Post: 15th February 2011, 20:26
  2. error while compiling ....
    By sh123 in forum Qt Programming
    Replies: 2
    Last Post: 13th December 2008, 07:23
  3. Replies: 1
    Last Post: 25th October 2008, 19:18
  4. i always get an error when compiling Qt4.4.0
    By mismael85 in forum Installation and Deployment
    Replies: 9
    Last Post: 21st July 2008, 14:08
  5. Error when compiling with x86-64
    By atm in forum Installation and Deployment
    Replies: 2
    Last Post: 28th July 2006, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.