473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can not use Directory::GetCurrentDirectory() in C++?


Why ?

void foo()
{
Directory::GetCurrentDirectory() ;
}
----------Compile Error-----------------------
C2039: 'GetCurrentDirectoryA' : is not a member
of 'System::IO::Directory'

Nov 16 '05 #1
1 5629
an*******@discussions.microsoft.com wrote:
Why ?

void foo()
{
Directory::GetCurrentDirectory() ;
}
----------Compile Error-----------------------
C2039: 'GetCurrentDirectoryA' : is not a member
of 'System::IO::Directory'


You've #included <windows.h>, which #defines GetCurrentDirectory as a macro
that expands to either GetCurrentDirectoryA or GetCurrentDirectoryW.

It's best to avoid using Win32 API names in your own code to avoid such
problems, but you can also just #undef GetCurrentDirectory after your
#includes.

-cd
Nov 16 '05 #2

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

Similar topics

7
by: Dan | last post by:
I have built a C# Windows application using a C# library hosted in a DLL. Both the library and the application need to access some files which at program installation are placed in the EXE's path;...
2
by: poppy | last post by:
Whenever I use "Directory.getcurrentdirectory" I always get "C:\WINDOWS\system32" despite the fact that the code is running from a subdirectory of wwwroot. Can someone help ? How can I get...
2
by: Chris | last post by:
Hi, how can I obtain the name of the directory where my aspx-file is located ? I tried : string str = Directory.GetCurrentDirectory(); DirectoryInfo dir = new DirectoryInfo(str); but...
3
by: Maileen | last post by:
Hi, I have a little trouble with the function "Directory.GetCurrentDirectory()". It seems that it keeps into memory the path of the Debug version of my application. It doesn't work correctly...
1
by: Avi | last post by:
Hi All, I am using following function to copy a file. System.IO.File.Copy(sourcefile,destFile); I am giving absolute path in destFile. (eg. "C:\avi.txt") After execution of this call, my...
4
by: roto23 | last post by:
I wrote a complied c# class (SpulClass). In that class I use this to get the directory it resides in.. System.IO.Directory.GetCurrentDirectory(); When I call this this class (dll) from a c#...
1
by: pb | last post by:
I am using asp.net and have some code in a file in the App_Code directory. I also have a text file in the same directory that I want to access. This file will always br in the same directory but I...
0
by: JohnIdol | last post by:
Hi Guys, anyone could help me understand the difference between these two methods? path =...
2
by: Kakkanattu | last post by:
Hi, In desktop application, we use different ways to get the current execution directory. I. AppDomain.CurrentDomain.BaseDirectory II. Environment.CurrentDirectory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.