QtCreator error with undeclared identifier 'Q_NULLPTR' - c++

This is an example of an error that I had when I tried to compile a very simple code.
The code works in Windows, but not in my Mac.
../../../../Qt5.8.0/5.8/clang_64/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:103:65:
error: use of undeclared identifier
'Q_NULLPTR'
../../../../Qt5.8.0/5.8/clang_64/lib/QtGui.framework/Headers/qabstracttextdocumentlayout.h:135:63:
error: use of undeclared identifier
'Q_RELOCATABLE_TYPE';
and there are more of errors like this.

Related

Libtorch operator/syntax errors in Visual Studio

Hi recently I’ve installed Libtorch and I was able to use it in my new Visual Studio project without a problem. Currently I am trying to use Libtorch in an existing CUDA project. But I am having these strange errors when I include torch header and I couldn’t find any solution in the internet regarding to my problem. Does anyone have any idea what might be the cause of these errors?
Severity Code Description Project File Line Suppression State
Error C2833 'operator {' is not a recognized operator or type DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2059 syntax error: 'newline' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2238 unexpected token(s) preceding ';' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2143 syntax error: missing ';' before 'const' DepthSensing e:\research\libtorch\include\c10\util\flat_hash_map.h 1433
Error C2833 'operator {' is not a recognized operator or type DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2059 syntax error: 'newline' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2238 unexpected token(s) preceding ';' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Error C2143 syntax error: missing ';' before 'const' DepthSensing e:\research\libtorch\include\c10\util\order_preserving_flat_hash_map.h 1552
Environment
Windows 10
CUDA 10.1
Visual Studio 2017
C++14
Thanks to #john I have realized that there was a macro in another library which has the same name as a typename in Libtorch library(which was a macro called V in my case), that’s why it was confused in compilation. I am sticking to this solution for now.
warning C4003: not enough actual parameters for macro 'max' - Visual Studio 2010 C++

error: C2065: 'QTcpSocket' : undeclared identifier

I use Qt creator 5.10 in windows 7.
When I build my project error occurs:
error: C2065: 'QTcpSocket' : undeclared identifier
error: C2065: 'QTcpclient' : undeclared identifier
QTcpSocket *tcpClient;
tcpClient = new QTcpSocket(this);
In your .pro file add QT += network and make sure to #include <QTcpSocket>.

Visual Studio Community 2015 MFC empty project doesn't compile

I just installed Visual Studio Community 2015 (version 14.0.24720.00) and tried to create an MFC dialog based project.
In the wizard I only selected "Dialog based", leaving all the other settings to default.
The project simply doesn't compile, which isn't exactly a promising starting point...
Am I overlooking something? Is the MFC template broken?
Below, the compile time errors I get (I cut away the long paths for the sake of legibility).
Thanks for your time.
program files (x86)\microsoft visual studio 14.01>------ Build started: Project: MFCApplication, Configuration: Debug Win32 ------
1> stdafx.cpp
1>c:\[...omissis...]\atlcore.h(639): error C2065: 'LOAD_LIBRARY_SEARCH_SYSTEM32': undeclared identifier
1>c:\[...omissis...]\uianimation.h(2621): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxanimationhelper.h(411): error C2065: 'UI_E_VALUE_NOT_SET': undeclared identifier
1>c:\[...omissis...]\afxanimationhelper.h(441): error C2065: 'UI_E_VALUE_NOT_SET': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2103): error C3646: 'm_pConfigs': unknown override specifier
1>c:\[...omissis...]\afxwin.h(2103): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxwin.h(2024): error C2065: 'GC_PAN_WITH_GUTTER': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2024): error C2065: 'GC_PAN_WITH_INERTIA': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2088): error C2065: 'GC_ALLGESTURES': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2030): error C2065: 'GID_ZOOM': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2030): error C2065: 'GC_ZOOM': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2036): error C2065: 'GID_ROTATE': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2036): error C2065: 'GC_ROTATE': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2042): error C2065: 'GID_TWOFINGERTAP': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2042): error C2065: 'GC_TWOFINGERTAP': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2056): error C2065: 'GID_PAN': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2056): error C2065: 'GC_PAN': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2062): error C2065: 'GID_PAN': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2062): error C2065: 'GC_PAN_WITH_SINGLE_FINGER_VERTICALLY': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2068): error C2065: 'GID_PAN': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2068): error C2065: 'GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2074): error C2065: 'GID_PAN': undeclared identifier
1>c:\[...omissis...]\afxw
in.h(2074): error C2065: 'GC_PAN_WITH_GUTTER': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2080): error C2065: 'GID_PAN': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2080): error C2065: 'GC_PAN_WITH_INERTIA': undeclared identifier
1>c:\[...omissis...]\afxwin.h(2964): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxwin.h(2964): error C3646: 'GetCurrentGestureInfo': unknown override specifier
1>c:\[...omissis...]\afxwin.h(2964): error C2059: syntax error: ')'
1>c:\[...omissis...]\afxwin.h(2965): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:\[...omissis...]\afxwin.h(3020): error C2061: syntax error: identifier 'PTOUCHINPUT'
1>c:\[...omissis...]\afxwin.h(3030): error C2061: syntax error: identifier 'PTOUCHINPUT'
1>c:\[...omissis...]\afxwin.h(3043): error C3646: 'm_pCurrentGestureInfo': unknown override specifier
1>c:\[...omissis...]\afxwin.h(3043): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxwin.h(4141): error C2061: syntax error: identifier 'TBPFLAG'
1>c:\[...omissis...]\afxwin.h(5447): error C2143: syntax error: missing ';' before '*'
1>c:\[...omissis...]\afxwin.h(5447): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxwin.h(5447): error C2238: unexpected token(s) preceding ';'
1>c:\[...omissis...]\afxglobals.h(315): error C2143: syntax error: missing ';' before '*'
1>c:\[...omissis...]\afxglobals.h(315): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxglobals.h(315): error C2238: unexpected token(s) preceding ';'
1>c:\[...omissis...]\afxadv.h(244): error C2143: syntax error: missing ';' before '*'
1>c:\[...omissis...]\afxadv.h(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\[...omissis...]\afxadv.h(245): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>c:\[...omissis...]\afxadv.h(314): error C2061: syntax error: identifier 'KNOWNDESTCATEGORY'
1>c:\[...omissis...]\afxadv.h(390): error C2065: 'ICustomDestinationList': undeclared identifier
1>c:\[...omissis...]\afxadv.h(390): error C2923: 'ATL::CComPtr': 'ICustomDestinationList' is not a valid template type argument for parameter 'T'
1>c:\[...omissis...]\afxadv.h(273): error C2039: 'AbortList': is not a member of 'ATL::_NoAddRefReleaseOnCComPtr<T>'
1>c:\[...omissis...]\afxadv.h(428): error C2065: 'IApplicationDestinations': undeclared identifier
1>c:\[...omissis...]\afxadv.h(428): error C2923: 'ATL::CComPtr': 'IApplicationDestinations' is not a valid template type argument for parameter 'T'
1>c:\[...omissis...]\afxadv.h(430): warning C4624: 'CAppDestinations': destructor was implicitly defined as deleted
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Solved.
Visual studio 2015 inherited the Visual Studio 2009 settings.
Removing the include folder
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
everything started to work normally
Had a similar problem bringing 2010 forward to 2015. Tracked the problem down to the targetver.h file. It was defining older versions of windows. Replaced all previous defines with the current default.
target.h
// delete everything here
#include <SDKDDKVer.h>
-- end of target.h
Maybe this can help you to fix your problem.
In Visual Studio 2015, C++ tooling is no longer installed by default. Instead, the C++ compiler, libraries, and project templates have been moved into an optional feature. Upon launching setup, you can choose a “Typical” or “Custom” install;
If you choose “Typical”, then you can’t use Visual Studio to develop in C++, because only managed languages and web development tools will be installed.
Setup Changes in Visual Studio 2015 Affecting C++ Developers

RPC_CSTR' : undeclared identifier while compile c++ using Nmake

I use rpcrt4.lib to generate dll. While generate dll using nmake ( cl.exe compiler) in Visual studio 2003 .Net, getting following error
nstaller\UUIDGenerator.cpp(35) : error C2065: 'RPC_CSTR' : undeclared identifier
installer\UUIDGenerator.cpp(35) : error C2059: syntax error : ')'
installer\UUIDGenerator.cpp(68) : error C2059: syntax error : ')'
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Cause :
I use following function
UuidToStringA(&uuid, (RPC_CSTR*)&str);
You need to link to rpcrt4.lib, which it sounds like you did.
But you also need to:
#include "Rpcdce.h"
This error
error C2065: 'RPC_CSTR' : undeclared identifier
Means that it doesn't know if this is a class, variable name, etc. That's why it needs the header file.

Winbase.h doesn't support in creating DLL file

I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?