I have a c2965 problem that I need to get solved. I am new to c++ and when I try to compile my script I get the following error.
error c2065:'long64' : undeclared identifier
on the line
long64 *x, *y;
I am not sure what have caused this and it seems that this is a relatively uncommon issue. I work on a 64bit system and uses a 64bit compiler installed in visual studio 2008.
If anyone know the cause, please answer this. Thanks beforehand
The error message is clear enough: the compiler does not see the definition of name long64, It is possible that the corresponding definition is present in some header file that you forgot to include in the module.
You can try to include header <cstdint> and use type int64_t instead of long64
Related
In trying to build Thrift with the TNonblockingServer (I hadn't before because it had libevent dependencies), I've come across this error:
error C2065: 'EWOULDBLOCK' : undeclared identifier
which is found in TNonblockingServer. EWOULDBLOCK is defined in a file called force_inc.h, but this file does not appear to be included in either the TNonblockingServer.h or the TNonblockingServer.cpp files.
I realize I could just #include the file and be done with it, but I was wondering if anyone with more experience with Thrift had encountered this issue before/knows if there is a more elegant way to fix this.
Any advice would be much appreciated.
It seems this occurs because I'm porting it over to VS2008, where the force_inc.h headers are not automatically included. In VS2010 and VS2012, this would not be the case.
I'm trying to create a Visual Studio project for code that contains
DL_EXPORT(void) initlua(void);
So I basically need a macro like
#define DL_EXPORT(retVal) __declspec(dllexport) retVal
Which works, but is OS/Compiler-specific, so I want to put that in the project*. But I can't figure out what to put in Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions (or in the Command Line) to do that. I'd think either of these would work:
DL_EXPORT(retVal) __declspec(dllexport) retVal
DL_EXPORT(retVal)=__declspec(dllexport) retVal
I'm leaning towards the latter, but neither seems to work - when compiling I get these errors:
error C2061: syntax error : identifier 'initlua'
error C2059: syntax error : ';'
error C2059: syntax error : 'type'
And compiling with /P to get the preprocessor result explains why: Nothing happened, so the compiler interpreted it as int DL_EXPORT(void) and expects a ;.
What is the right syntax for the definition? Or is there none, as people in this question assumed?
Thanks.
* I'm not using a simple #ifdef-check for MSVC because I'm just trying to create a Visual Studio project for an existing library (lunatic python) with existing build scripts that I don't want to break. Although I could admittedly use #ifndef DL_EXPORT - but I'd still like to know if I'm missing something or if this is just impossible to do in Visual Studio.
I think it should be possible to use /FI on the commandline to specify an include file to include automatically in every source file. In that file you put the #define statements you need.
When I create a new msvc project and try using the type uint8_t I get the following compile error:
error C2065: 'uint8_t' : undeclared identifier
Is there a project setting or predefined include that I can use? I'd prefer not to typedef values explicitly.
You need to include <stdint.h> (or <cstdint>), which is not available prior to VS2k10 as far as I can tell.
If you're using an older version of cl you can search for an open source implementation that meets your licensing requirements, or if none exist you'll have to supply the typedefs yourself.
Boost library have some definitions for this. But it's only for C++.
I have the following trivial file named Temp.cpp:
#include <string>
int main() { return 0; }
and I'm trying to compile it with the following command-line in the Windows XP Free Build Environment, using WDK 7.1:
cl.exe /Iinc\api\crt\stl70 /Iinc\crt C:\Temp.cpp
and I'm getting really random errors like:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.207 for 80x86
C:\WinDDK\7600.16385.1\inc\api\crt\stl70\iosfwd(202) :
error C2144: syntax error : 'int' should be preceded by ';'
The error goes away if I use stl60 instead of stl70, but that doesn't solve the problem.
What's the cause of the problem?
Update: I tried uninstalling and installing the WDK again, but nothing changed. :(
Update 2: Okay, apparently the error is screaming out at the header file itself: _SCL_INSECURE_DEPRECATE is the cause. Does anybody know how to turn it off correctly? (If I just comment out the lines, I get a ton more errors regarding a bunch of other macros.)
Found the answer myself, through modifying the headers and guess'n'checking:
I need to have _STL70_ defined.
Which cl.exe are you picking up? If your path happens to have an older (VC6) compiler before the WDK one, you'd expect these errors. VC6 can't compile the STL as shipped with VC7
apparently the error is screaming out at the header file itself: _SCL_INSECURE_DEPRECATE is the cause. Does anybody know how to turn it off correctly?
If you're having problems with _SCL_INSECURE_DEPRECATE, try setting:
/D_SCL_SECURE_NO_DEPRECATE
But given the error message you're seeing it sounds like you're the compiling headers with a a compiler that's older than the headers support (so this might not get you very far anyway).
I'm trying to use iphlpapi (GetAdapterInfo) and am having trouble compiling the code. I have iphlpapi.h from SDK 7 and have added the appropriate path to the include files in visual studio.
I get the following error...
c:\program files\microsoft sdks\windows\v7.0\include\ifdef.h(154) : error C2146: syntax error : missing ';' before identifier 'NET_IFTYPE'
The lines in ifdef where this occurs are shown below.
typedef NET_LUID IF_LUID, *PIF_LUID;
typedef ULONG NET_IFINDEX, *PNET_IFINDEX; // Interface Index (ifIndex)
typedef UINT16 NET_IFTYPE, *PNET_IFTYPE; // Interface Type (IANA ifType)
I finally figured out how to get this to work so I'm putting this here for others who might stumble upon it.
First, I'm using visual c++ version 6.0 with the 2003 sdk. I added the sdk as the first choice using TOOLS->OPTIONS->DIRECTORIES. Adding the include winsock2.h caused about 60 redefinition errors. I found several sources telling me that the winsock2 include had to precede the windows.h include. My windows.h include was generated for me by VC++ in the precompiled header stdafx.h so I moved the winsock2.h include there. I now can compile and run my program!
According to this page, it looks as though you might need to make sure winsock2.h is included first. I'm guessing that it defines some of those types.
Also, the MSDN page for NET_LUID says it requires Vista at a minimum. Make sure that's true.