I am using MS-Windows XP SP3 and Visual C++ compiler. Now when I define one macro as-
#define APPVERSION(n) ((int32)0 + n)
and used it as -
if(APPVERSION(2)>= APPVERSION(1)) it is giving me an error as
fatal error C1012: unmatched parenthesis : missing ')'
but when I use that macro as -
#define APPVERSION(n) (0L + n)
It works without any error.
What is exact problem?
Your question is very hard to answer without you providing the complete error message, but I'm guessing it includes something like this as the first line in the error message:
error C2065: 'int32' : undeclared identifier
You have to make sure that the type-alias int32 exists, either by including the correct header where it's defined or define it yourself. And by "define" I mean there should be either a preprocessor #define directive or a typedef.
Related
I am facing a compile error using MSVC 19.0.24213.1 and couldn't find the root cause now.
Compiler Message:
fatal error C1001: An internal error has occurred in the compiler. [xyz.vcxproj]
(compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\treevisitor.h', line 22)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
The line where it fails is a call to a private member function within myClass:
update(inputData, number, state);
which is declared in the header as templated function:
template <class TType, int Size>
void myClass::update(
InputType_t<TType, Size>& inputData,
int& number,
State& state);
I wonder what could be the cause here? Maybe the compiler struggles with instantiating the template parameters of the function? Maybe the fact that the error comes treevisitor.h give a hint?
I started using WPP for tracing in my driver. I defined the macro DoTraceLevelMessage in order to support log level (similar to TraceDrv sample code). My tracing code looks like this:
DoTraceLevelMessage(TRACE_LEVEL_INFORMATION, DEFAULT_FLAG, "Driver is loaded");
This makes the tracing lines a little long, so I want to use some kind of aliases, for example:
#define LOG_INFO(msg,...) DoTraceLevelMessage(TRACE_LEVEL_INFORMATION, DEFAULT_FLAG, msg, __VA_ARGS__)
So the above code will look like this:
LOG_INFO("Driver is loaded");
I can't seem to make it work with WPP. I think WPP pre-processor runs before the compiler pre-processor so the above macro doesn't expand as I expect. I get the following compilation error:
1>test_driver.c(70): error C4013: 'WPP_CALL_test_driver_c70' undefined; assuming extern returning int
1>test_driver.c(70): error C2065: 'DEFUALT_FLAG': undeclared identifier
When I use the DoTraceLevelMessage macro, everything is ok. Any idea how can I define such aliases?
For my current project, I needed to convert from String^ to std::string and vice-versa a lot. I read I could accomplish that by marshaling (from what I've read it's a process of conversion between native and managed data types because they are handled differently in the memory).
I read the instructions off of this topic. I put the code in a button event. Since I'm a beginner, I didn't really know which file do I need to include <msclr\marshal_cppstd.h> in. After reading pre-made descriptions in each of the files, I included the library in stdafx.h, which produced the following errors:
error C2065: 'marshal_as' : undeclared identifier
error C2275: 'std::string' : illegal use of this type as an expression
When including it in the main .cpp and stdafx.cpp files, one of the errors I get is:
error C2872: 'IServiceProvider' : ambiguous symbol
even though I included the file before any "using" directive, as advised here.
Thanks in advance.
I'm trying to compile a program with openmpi, my code does not give any errors but instead one of the mpi headers does:
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected identifier before numeric constant
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/mpicxx.h:168: error: expected unqualified id before numeric constant
The relevant line of code in the header simply reads:
namespace MPI {
I am using the mpiCC compiler. Am I doing something wrong? or is this a bug in openmpi?
Thanks in advance.
Though I am not able to reproduce the problem you encountered, the following comments can be found in mpi.h, from which mpicxx.h is included:
/*
* Conditional MPI 2 C++ bindings support. Include if:
* - The user does not explicitly request us to skip it (when a C++ compiler
* is used to compile C code).
* - We want C++ bindings support
* - We are not building OMPI itself
* - We are using a C++ compiler
*/
#if !defined(OMPI_SKIP_MPICXX) && OMPI_WANT_CXX_BINDINGS && !OMPI_BUILDING
#if defined(__cplusplus) || defined(c_plusplus)
#include "openmpi/ompi/mpi/cxx/mpicxx.h"
#endif
#endif
If you are not using the deprecated C++ bindings, then a possible workaround is to add
-DOMPI_SKIP_MPICXX
to your CXXFLAGS. Hope this may help.
I have a program that doesn't seem to recognize declared types in the latest U3D software. There's a line
typedef BOOL (WINAPI* GMI)(HMON, LPMONITORINFOEX);
which gets the error:
Error 1 error C2061: syntax error : identifier 'LPMONITORINFOEX' c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 28
and a line
MONITORINFOEX miMon;
which gets
Error 5 error C2065: 'miMon' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49
Error 3 error C2065: 'MONITORINFOEX' : undeclared identifier c:\Projects\U3D\Source\RTL\Platform\Common\Win32\IFXOSRender.cpp 49
The program's first non-comment statement is #include <windows.h>, which includes winuser.h, which defines these identifiers. In Visual Studio, I can right-click on them and go to the definition (a typedef) and from the typedef to the struct. WINAPI is defined in WinDef.h, so that seems to be working. There are no redefinitions of LPMONITORINFOEX or MONITORINFOEX in any other file.
So, how can this be happening, and what can I do about it?
My guess is something is up with your WINVER define. If you look at winuser.h, those are only defined in the block:
#if(WINVER >= 0x0500)
Is it possible that your WINVER is incorrectly set?