473,788 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C2065 Error

Hi all,

Running into a little problem. I wrote a small app on VC++ 7.1 that calls
the GetDefaultPrint er() function. Now I have to "downgrade" it to VC++ 6,
but every time I compile I get the following error:

--------------------Configuration: enumprinters - Win32
Debug--------------------
Compiling...
CPrinters.cpp
C:\Store_BN_2\I NSTORE\Bnutils\ bin\enumprinter s\CPrinters.cpp (67) : error
C2065: 'GetDefaultPrin ter' : undeclared identifier
Error executing cl.exe.

enumprinters.dl l - 1 error(s), 0 warning(s)

I'm including windows.h, winspool.h and have a #pragma comment(lib,
"Winspool.l ib") line as well. Anyone have any ideas what else I should try?
Thanks.
Jul 7 '06 #1
9 2311
BTW, the app compiles and runs fine on VC++ 7.1, but won't compile on VC++
6. I might not have made that clear before. Thanks

"Mike C#" <xy*@xyz.comwro te in message
news:OA******** ******@TK2MSFTN GP05.phx.gbl...
Hi all,

Running into a little problem. I wrote a small app on VC++ 7.1 that calls
the GetDefaultPrint er() function. Now I have to "downgrade" it to VC++ 6,
but every time I compile I get the following error:

--------------------Configuration: enumprinters - Win32
Debug--------------------
Compiling...
CPrinters.cpp
C:\Store_BN_2\I NSTORE\Bnutils\ bin\enumprinter s\CPrinters.cpp (67) : error
C2065: 'GetDefaultPrin ter' : undeclared identifier
Error executing cl.exe.

enumprinters.dl l - 1 error(s), 0 warning(s)

I'm including windows.h, winspool.h and have a #pragma comment(lib,
"Winspool.l ib") line as well. Anyone have any ideas what else I should
try? Thanks.

Jul 7 '06 #2
"Mike C#" <xy*@xyz.comwro te in message
news:OA******** ******@TK2MSFTN GP05.phx.gbl...
--------------------Configuration: enumprinters - Win32
Debug--------------------
Compiling...
CPrinters.cpp
C:\Store_BN_2\I NSTORE\Bnutils\ bin\enumprinter s\CPrinters.cpp (67) : error
C2065: 'GetDefaultPrin ter' : undeclared identifier
Error executing cl.exe.

enumprinters.dl l - 1 error(s), 0 warning(s)

I'm including windows.h, winspool.h and have a #pragma comment(lib,
"Winspool.l ib") line as well.
Look at the help entry for the function. It says that the function is
declared in <winspool.hbu t that you should include <windows.>. It also
says that the function was introduced with 2K. So you should define the
version of NT that you target

#define _WIN32_WINNT 0x0500

either in the source as above or in the IDE.

If you are doing the compilation on an old box, it may be that it has stale
SDK headers and libraries. If that's the case, you may need to update the
Platform SDK there and point the IDE at the SDK's headers and libraries
rather than its own.

Regards,
Will

Jul 7 '06 #3
I'm already including <windows.hand <winspool.h>. I'll add the #define
and see if the results are any better. I'm trying to compile it on the same
box where I have both VC++ 6 and VC++ 7.1. The code compiles and runs fine
on 7.1, but not on 6. Can I point my VC++ 6 source to use the 7.1 include
directories? I thought there would probably be some compatibility issues
there.

Thanks

"William DePalo [MVP VC++]" <wi***********@ mvps.orgwrote in message
news:eR******** ******@TK2MSFTN GP05.phx.gbl...
"Mike C#" <xy*@xyz.comwro te in message
news:OA******** ******@TK2MSFTN GP05.phx.gbl...
>--------------------Configuration: enumprinters - Win32
Debug--------------------
Compiling...
CPrinters.cp p
C:\Store_BN_2\ INSTORE\Bnutils \bin\enumprinte rs\CPrinters.cp p(67) : error
C2065: 'GetDefaultPrin ter' : undeclared identifier
Error executing cl.exe.

enumprinters.d ll - 1 error(s), 0 warning(s)

I'm including windows.h, winspool.h and have a #pragma comment(lib,
"Winspool.lib" ) line as well.

Look at the help entry for the function. It says that the function is
declared in <winspool.hbu t that you should include <windows.>. It also
says that the function was introduced with 2K. So you should define the
version of NT that you target

#define _WIN32_WINNT 0x0500

either in the source as above or in the IDE.

If you are doing the compilation on an old box, it may be that it has
stale SDK headers and libraries. If that's the case, you may need to
update the Platform SDK there and point the IDE at the SDK's headers and
libraries rather than its own.

Regards,
Will

Jul 7 '06 #4
"Mike C#" <xx*@xyz.comwro te in message news:8r******** *******@fe11.lg a...
I'm already including <windows.hand <winspool.h>.
Go here:

http://msdn.microsoft.com/library/de...tspol_0hma.asp

scroll down to take a look at the requirements section. If the docs say
include <windows.hyou should do so. They don't say include <winspool.hso
you should not.
I'll add the #define and see if the results are any better.
In case you don't know, there is nothing really special about
GetDefaultPrint er(). Unlike the case with the .Net platform where in effect
several versions of the platform exist on the same box, there is only one
copy of Windows on a system. Further, unlike .Net, a single tool can target
multiple platforms. That being the case, you have to tell your tools what
platform to target. VS6, because it was released earlier than 2K, can't
possibly make the definition of platform on its own where your copy of 7.1,
released later, just may be doing that.
I'm trying to compile it on the same box where I have both VC++ 6 and VC++
7.1. The code compiles and runs fine on 7.1, but not on 6. Can I point
my VC++ 6 source to use the 7.1 include directories?
No. Carl Daniel and others have posted here at length on the differences
between the libraries for various versions of the compiler. I can't believe
anything good can come of mixing and matching the C and C++ headers.

On the other hand, I would install the most recent Platform SDK on the box
and then adjust both IDEs do that each uses the same includes and libraries.
As I understand it, there are some corner cases where the PSDK is
incompatible with the old compiler. I'm not sure what they are. I think that
they have to do with things I rarely use like graphics or something. I might
be wrong.
Thanks
You are welcome.

Regards,
Will
Jul 8 '06 #5
I'll eliminate the #include <winspool.h>, but I don't think that will fix
the issue as I've already tried it. I tried to install the Platform SDK but
received an error during installation that some of the files could not be
found during installation. I'll try again tomorrow and hope I have more
success.

Thanks.
Jul 10 '06 #6
"Mike C#" <xx*@xyz.comwro te in message news:Gg******** *******@fe11.lg a...
I'll eliminate the #include <winspool.h>, but I don't think that will fix
the issue as I've already tried it.
I won't. You need

1) to add the #define so that the compiler knows that you target 2K and
later
2) to install the PSDK headers released after 2K, VC6's predate 2K

Regards,
Will
Jul 10 '06 #7
Hi Will,
2) to install the PSDK headers released after 2K, VC6's predate 2K
The latest platform SDK to support VC6 is the one released in February, 2003.
I'm not sure how to get it anymore, though, casual googling didn't turn up
any links.
I still have it on disc, but I don't know about downloads.

--
Best Regards,
Kim Gräsman
Jul 10 '06 #8
Had to download the PSDK in pieces, but finally got it installed. Now it
compiles correctly (without the #define), but I'm encountering a new and
unrelated LNK1561 error when I try to add this particular project to another
project and compile. <Growl/>.

Thanks

"Kim Gräsman" <ki*@mvps.orgwr ote in message
news:45******** *************** ***@news.micros oft.com...
Hi Will,
>2) to install the PSDK headers released after 2K, VC6's predate 2K

The latest platform SDK to support VC6 is the one released in February,
2003. I'm not sure how to get it anymore, though, casual googling didn't
turn up any links.
I still have it on disc, but I don't know about downloads.

--
Best Regards,
Kim Gräsman


Jul 10 '06 #9
Follow-up: Finally got it all working. It turns out the Platform SDK also
incorporates buffer overrun detection and I had to reference the
bufferoverflowU .lib library to get everything working in the end. Lawd I
can't wait until we move completely away from VC++ 6! :)

Thanks all.

"Kim Gräsman" <ki*@mvps.orgwr ote in message
news:45******** *************** ***@news.micros oft.com...
Hi Will,
>2) to install the PSDK headers released after 2K, VC6's predate 2K

The latest platform SDK to support VC6 is the one released in February,
2003. I'm not sure how to get it anymore, though, casual googling didn't
turn up any links.
I still have it on disc, but I don't know about downloads.

--
Best Regards,
Kim Gräsman


Jul 11 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2525
by: SilverSurver | last post by:
Hi all, During the build of a MFC application on a Windows XP system I get the error C2065 'memset' : undeclared identifier. When building this same application on Windows 2000 platform no errors occur. My question is: Can somebody give me some information related to this error.
0
1728
by: Olivier | last post by:
VC don't find "WideCharToMultiByte" when I try to compile this code : bug_report.cpp(18) : error C2039: 'CPCP_ACP' : n'est pas membre de 'operator``global namespace''' bug_report.cpp(18) : error C2065: 'CPCP_ACP' : identificateur non déclaré bug_report.cpp(18) : error C3861: 'WideCharToMultiByte': identificateur introuvable, même avec une recherche qui dépend de l'argument
1
5616
by: Scott Chang | last post by:
Hi All I tried to use the attached OpenGL code to draw a Star-shaped figure on my Microsoft Visual C++ .NET 2002-Windows XP Pro PC. When I did 'Build' in Debug Mode, I got an error C2065: 'RenderScence': undeclared identifier. Please help and tell me (1) what it is wrong with my coding in this program and how to correct the problem, and (2) whether the functions/commands of the OpenGL v1.1 (existing in Microsoft Visual C++ .NET 2002) and GLUT...
2
1839
by: VicVic | last post by:
Hello, I have an old project, built with VC++. Now need to be compiled in Visual Studio .Net 2003. The project is going to build a DLL. When i try to compile the project, i got the following errors: c:\thepath\aaa.cpp(890): error C2065: 'm_nBackStyle' : undeclared identifier c:\thepath\aaa.cpp(890): error C3861: 'm_nBackStyle': identifier not found, even with argument-dependent lookup
10
11810
by: teddarr | last post by:
I am trying to construct a class with several functions and identifiers. The identifier in question is static double AIR which will hold the value of the annual interest rate in the class. I have been getting an error message that I can't seem to get rid of: error C2065: 'AIR' undeclared identifier I have never worked with static identifiers before and I think I'm leaving something out somewhere but I don't know what. Here's the...
4
3599
by: jsl | last post by:
i have converted my project from vc++ 6.0 to visual studio 2005, then the following code is giving me a problem sample() { //int i; -------------(1) for(int i=0; i<5;i++)-------------(2) { ...... ..... }
1
5182
by: greatsimon | last post by:
Hi,anyone. I using VC6++ doing project to build dll from the code and the error code undeclared identifier show, any help?? I included my code here: #include "stdafx.h" #include "invertframe2.h" #include <stdlib.h> #include <stdio.h> #include "string.h"
2
2477
by: zelmila19 | last post by:
Hi, I'm doing C++ with visual studios 2005 and recently did this program #include <iostream> int num1; int num2; int answer; char operation;
4
3612
by: backen | last post by:
Hi! i cant get this code to work, I get error c2065, undeclared identifier for some reason don´t really know why... this results in error C2146: syntax error : missing ';' before identifier 'Sorter' and error C2065: 'Sorter' : undeclared identifier.... furthermore, I am not sure that my sorter will work (later problem =)) And I hope here is a kind soul that can help me out =) the code: #include <iostream> #include <string>
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.