Error in Visual Studio while debugging "parameter 'basepath' cannot have zero length" - c

I am facing this error while trying to debug C code in Visual Studio 2010. When searched in google all i could find something related is as below
http://connect.microsoft.com/VisualStudio/feedback/details/615793/badly-formed-debugger-command-causes-error-parameter-basepath-cannot-have-zero-length.
Any suggestions to overcome this is really appreciated . Thanks

Same problem, I was building a function library to load on demand, but got this message. It is a matter of don't quote the VSDebugger options.
Remove the double quotes from
the full path of the executable
the command arguments
the working directory
embedded spaces can be passed to the command line by single quotes, if really required.

I had the same error message with only the name of the executable in the command (so no full path). It used to work pefectly, but suddenly it didn't. I checked the path variable and somehow there were two consecutive ';' in there. I fixed that and the problem disappeared.

In my case the command line did not have .exe extension at the end (Properties->ConfigurationProperties->Debugging->Command). Adding the extension fixed the problem.

For me "Parameter "basePath" cannot have zero length" was caused when I set my configuration properties->debugging->command to "regsvr32.exe $(TargetPath)" to debug my project registration. I fixed this by setting the command to "regsvr32.exe" and command arguments to "$(TargetPath)"

If you set up a makefile project (I guess it's the case), be sure that the file you put in Configuration Properties -> Debugging -> Command exists.
(and I think it doesn't accept batch files, but I'm not 100% sure)

check your path in: Configuration Properties -> Debugging -> Working Directory.
check that this path is a valid path in your machine.

I've solved this problem with setting value of Properties->Debugging->Command to another, and after it set back to my default.

Also make sure Visual Studio is running "As Administrator". This fix it for me.

Related

OpenPBS build error - Unknown type name 'jid_t'

I already installed OpenPBS previously. I wanted try to configure with different command this time and install it.
command :
./configure --prefix=/opt/pbs --enable-alps
and I get this error :
I followed this article previously and it works but with different configuration it shows this error. I want to configure OpenPBS on node(client) and looks like i have to user this command so i tried it. Thanks in advance ^^
Try it without "--enable-alps" in the config file. enable-alps has nothing to do with commands.

Could not find file 'C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\...\MonitoringSystemDatabase.mdb'

I have a Menu Form and it has 7 UserControls every time I execute my program I keep seeing this error.
I have no idea what error is this. I tried searching but there are no error close related to mine. Then I compare my error with this Project Assemblies error
Can anyone help me with this? I have no idea what causes this error.
The error is caused by your code looking for the MS Access database file called:
MonitoringSystemDatabase.mdb
...is located at path:
C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\cjz5kapb01\
...but it is not.
Locate file MonitoringSystemDatabase.mdb (perhaps with +E to Search), note the actual path of the file, and correct the path in MainMenu.vb.
The error message is very clear, so why all the searching?
Either the file isn't there, or the application can't see it where it expects to find it.
Try moving the file to:
C:\Users\Public\Documents\MonitoringSystemDatabase.mdb
and adjust you project accordingly.

Does the linker in VC2008 has problem with spaces in paths?

the previous question I asked was about how can I use .lib file with a VC2008 project and the answers were very useful.Now another problem has crept in--for eg. my .h and .lib files are in the folder c:\pcm.I specify this path at the required places(c/c++->additional include directories,linker->input->additional dependencies).Every thing works fine.
but when I change the path to "c:\pc m"(notice the space) and reflect this change at required places:linker->input and additional include directories etc.
Now on building I get: Error1 fatal error LNK1104: cannot open file 'c:\pc.obj'
what's the solution to this problem??
thanks.
The nearly universal answer to problems with spaces in path/file names:
put the path/file name in quotes.
Note that this works even if you're using a VS macro for as part of the name:
"$(OutDir)\foo.lib"
works (while without quotes it breaks due to spaces in the $(OutDir) macro).
I've never had any problem related to this.
Using double quotes around path names is wise. It is required when they contain spaces. Post the compile command line you find in buildlog.htm if that doesn't help.

fopen fails mysteriously under Windows

Maybe I just have another black out but, this one line is giving me a lot of troubles:
FILE *fp = fopen("data/world.data", "rb");
This works fine under Linux when compiled with GCC. But when I compile it with Visual Studio, it crashes. fp is always NULL. Both the BIN and the EXE are in the exact same directory. Now, to make things even crazier, when I run the EXE using Wine under Linux... it... works...
I have absolutely not a god damn clue what's going on here. Maybe it's some insanely stupid mistake on my side, but I cannot get this thing to run under Windows :/
Also, I have another program which works just fine, there the data files are also contained in a sub directory named data.
EDIT:
To make it clear neither / NOR `\ * do work.
EDIT 2:
OK I've given up on this, maybe someone has fun trying to figure it out, here's ZIP containing the EXE, Debug Data for VS etc.:
https://dl.dropbox.com/u/2332843/Leaf.zip
EDIT 3:
Compiled it with CodeBlocks and MinGW, works like a charm. Guess it has to do something with MSVC or the Project Settings in VS.
It sounds like data isn't a subdirectory of your current directory when you run the program. By default (for x86 targets) VS will build and run your program from either a DEBUG or RELEASE subdirectory of the base directory you've created for the project. You can modify the directory that will be "current" when it runs though (e.g., project | properties | configuration properties | debugging for VS 2008).
Edit: While Windows requires that you use a backslash as a directory separator at the command line, a forward slash works fine in code -- this is not the source of your problem.
In windows you have to write the following:
FILE *fp = fopen("data\\world.data", "rb");
This is like that because the backslash is a special character (so a backslash in a string is written using \ and a quotation symbol is \" and so with other special characters).
Since this issue happens only on windows. I doubt whether the file is really named "world.data". As you know, the default setting for windows hides the file extention. Is its real name world.data.xxx?
Include a line to GetCurrentDirectory(), to see if you are running from the directory you expected.
When I develop in C#/ C++ on visual studio, I normally get to run it from the debug folder. I don't think it matters if forward slash is used in place of backslash in .net.
I happened to have the same problem, and suddenly i figured it out.
That should be your windows fault.
Let's say, FILE *fp = fopen("data/world.data", "rb"); in windows, if you hide the extensions, then you can see the file data/world.data, but actually it maybe /data/world.dat.txt or somewhat.
So please check the extensions.
Hope it helps!
I ran into this today, and it happened because I used "br" instead of "rb" on that mode argument.
The underlying fopen is throwing an exception of some kind, which only registers as a crash. It's not bothering to return the standard NULL response or set the associated error values.
I'm not sure but it may be because you're using slash instead of (an escaped) backslash in the path?

nsinstall: Bad file number error on Vista

I'm attempting to build Firefox on my Windows Vista Ultimate machine. I keep getting the following error:
nsinstall: Bad file number
I've read that this error is caused because of UAC in Vista. Here are the two articles that lead me to this conclusion. https://wiki.mozilla.org/Penelope_Developer_Page#Windows_Vista and http://www.kevinbrosnan.net/mozilla-build-error-nsinstall-bad-file-number
Using the standard "Run as Administrator", I've attempted to redo my build but I get the exact same error. I also started a normal command prompt as admin and then went to the batch file in mozilla-build (start-msvc8.bat) and ran it. Still, same error at the same point.
Any other insights on how I might either get around this error or perhaps something else is causing the error?
Note: I also posted something here in the hopes to get topic-specific help but I've not heard a peep... After I posted that I found the info on nsinstall. Anyway, I prefer SO so I thought I'd try here...
Update: I've attempted to completly disable UAC to correct the problem as is suggested by cnemelkasr. I've received the exact same error. This new knowledge is making me think that a file or folder is missing... Does anyone who has experience with NSInstall know what the given error -- Bad file number -- might mean? I figure it might be referring to a file handle...
If it really is a UAC error, you can try turning off UAC altogether. I've had to do this for several packages. There are numerous places on the web to get the instructions for doing that.
http://www.petri.co.il/disable_uac_in_windows_vista.htm is one of them.
I found the answer to my question. I'm posting the answer here to share the answer with others and to close this question.
After disabling the UAC, it was suggested that the directory depth was interfering with NSInstall. I moved the folder from c:/Users/Frank/Documents/hg-repos/firefox-src-hgRepo/mozilla-fv-expirement/ to C:/mozilla-fv-expirement/. Cleaned all previous build attempts and finally redid my build (with UAC off) and I received a working debug binary.
The suggestion was posted at: mozilla.dev.builds
The "Bad file number" message in the cases I have seen, is caused by too many arguments passed to execvp (command, argv) (or similar) function. But only from some programs. An old bash, sh or a Borland/Watcom program in your PATH is an likely candidate.
So when you shorten the name of the build directory, the total size of the command line (that eventually gets passed to CreateProcess()) gets shorter. I don't think UAC has anything to do with this since I've seen this on Win-XP too. But it's a bit strange Mozilla would not use relative paths while building. I guess it uses some directory prefix value in it's makefiles (I've never tried building it).
If you look at the documentation for _execvp():
http://msdn.microsoft.com/en-us/library/3xw6zy53.aspx
E2BIG is one of the possible errno values:
The space required for the arguments and environment settings exceeds 32 KB.
Now, here is the strange part.
Fact 1:
On Visual-C/MingW (any version), strerror(EBADF) doesn't return "Bad file number" .
(it return "Bad file descriptor").
Fact 2:
On Borland's CBuilder 5.6 and Watcom 1.9 (these do not use the MSVC runtime), strerror(EBADF) does indeed return "Bad file number".
Theory:
Is possible that Borland, Watcom (and other CRTs too?) mixes up the meaning of E2BIG and EBADF. Did that make any sense? Someone please correct me if you have a better theory.
I'm a bit confused myself...
Conclusion: Either shorten the size of your environment (easiest) or shorten the command-line (not always easy).
--gv

Resources