Help Wanted

Visual C++ 6.0 – CPUFreak91

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
I think i have a bad CD or something everythime i try to compile anything (exept a simple program with only <studio.h> and <iostream.h> ) i get at least two errors. I'm trying to compile J2se and a few other source codes but I can't with this weird problem. any help?

------------------
Love, Life and Linux

Wacko4X

Member

Posts: 92
From: Bellvue, WA, USA
Registered: 08-21-2002
What are the errors you recieve?

------------------
There are 10 people in this world, those who understand binary and those who dont.

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
here's a link (im posting this and uploading the avi files at the same time so if it doesn't work. Try again in a min or two) (time 3:52 ET PM)

www.troychurchofchrist.org/guatemala/js/CCN/VC++prob.html

------------------
Love, Life and Linux

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
never mind uploadings too slow.
I don't know what erors i receive. it says compiling #(instert name) then it finishes and sez 1 error (sometimes it may say 2,3 or 5)
I have no idea where to look for error details. When i try to compile the .exe file i get the same amount of errors

------------------
Love, Life and Linux

CoolJ

Member

Posts: 354
From: ny
Registered: 07-11-2004
quote:
Originally posted by CPUFreak91:
.. except a simple program with only <studio.h> ..


do you mean <stdio.h>? the error message should appear in your Output window.

If your output window is closed you might have to enable it from the View menu option.

Briant

Member

Posts: 742
From: Stony Plain, Alberta, Canada
Registered: 01-20-2001
quote:
Originally posted by CPUFreak91:
I don't know what erors i receive.

Can you copy/paste the errors into a post so we can see them?

------------------
Brian

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
Here's my code:

/*
* @(#)linker_md.c 1.9 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/

/*
* Maintains a list of currently loaded DLLs (Dynamic Link Libraries)
* and their associated handles. Library names are case-insensitive.
*/

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

#include "sys.h"

#include "path_md.h"

/*
* From system_md.c v1.54
*/
int
dbgsysGetLastErrorString(char *buf, int len)
{
long errval;

if ((errval = GetLastError()) != 0) {
/* DOS error */
int n = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errval,
0, buf, len, NULL);
if (n > 3) {
/* Drop final '.', CR, LF */
if (buf[n - 1] == '\n') n--;
if (buf[n - 1] == '\r') n--;
if (buf[n - 1] == '.') n--;
buf[n] = '\0';
}
return n;
}

if (errno != 0) {
/* C runtime error that has no corresponding DOS error code */
const char *s = strerror(errno);
int n = strlen(s);
if (n >= len) n = len - 1;
strncpy(buf, s, n);
buf[n] = '\0';
return n;
}

return 0;
}

/*
* Rest Adapted from JDK1.2 linker_md.c 1.43 98/09/28
*/

/*
* create a string for the JNI native function name by adding the
* appropriate decorations.
*
* On Win32, "__stdcall" functions are exported differently, depending
* on the compiler. In MSVC 4.0, they are decorated with a "_" in the
* beginning, and @nnn in the end, where nnn is the number of bytes in
* the arguments (in decimal). Borland C++ exports undecorated names.
*
* dbgsysBuildFunName handles different encodings depending on the value
* of encodingIndex. It returns 0 when handed an out-of-range
* encodingIndex.
*/
int
dbgsysBuildFunName(char *name, int nameMax, int args_size, int encodingIndex)
{
if (encodingIndex == 0) {
/* For Microsoft MSVC 4.0 */
char suffix[6]; /* This is enough since Java never has more than
256 words of arguments. */
int nameLen;
int i;

sprintf(suffix, "@%d", args_size * 4);

nameLen = strlen(name);
if (nameLen >= nameMax - 7)
return 1;
for(i = nameLen; i > 0; i--)
name[i] = name[i-1];
name[0] = '_';

sprintf(name + nameLen + 1, "%s", suffix);
return 1;
} else if (encodingIndex == 1)
/* For Borland, etc. */
return 1;
else
return 0;
}

/*
* Build a machine dependent library name out of a path and file name.
*/
void
dbgsysBuildLibName(char *holder, int holderlen, char *pname, char *fname)
{
const int pnamelen = pname ? strlen(pname) : 0;
const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
char *suffix;

#ifdef DEBUG
suffix = "_g";
#else
suffix = "";
#endif

/* Quietly truncates on buffer overflow. Should be an error. */
if (pnamelen + strlen(fname) + 10 > (unsigned int)holderlen) {
*holder = '\0';
return;
}

if (pnamelen == 0) {
sprintf(holder, "%s%s.dll", fname, suffix);
} else if (c == ':' || c == '\\') {
sprintf(holder, "%s%s%s.dll", pname, fname, suffix);
} else {
sprintf(holder, "%s\\%s%s.dll", pname, fname, suffix);
}
}

void *
dbgsysLoadLibrary(const char * name, char *err_buf, int err_buflen)
{
void *result = LoadLibrary(name);
if (result == NULL) {
/* Error message is pretty lame, try to make a better guess. */
long errcode = GetLastError();
if (errcode == ERROR_MOD_NOT_FOUND) {
strncpy(err_buf, "Can't find dependent libraries", err_buflen-2);
err_buf[err_buflen-1] = '\0';
} else {
dbgsysGetLastErrorString(err_buf, err_buflen);
}
}
return result;
}

void dbgsysUnloadLibrary(void *handle)
{
FreeLibrary(handle);
}

void * dbgsysFindLibraryEntry(void *handle, const char *name)
{
return GetProcAddress(handle, name);
}

------------------
Love, Life and Linux

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
here's my erorr. Note that I'm trying to install j2se on my system.

--------------------Configuration: linker_md - Win32 Debug--------------------
Compiling...
linker_md.c
f:\documents and settings\joseph quigley\desktop\new folder\linker_md.c(18) : fatal error C1083: Cannot open include file: 'sys.h': No such file or directory
Error executing cl.exe.

linker_md.obj - 1 error(s), 0 warning(s)

------------------
Love, Life and Linux

Briant

Member

Posts: 742
From: Stony Plain, Alberta, Canada
Registered: 01-20-2001
sys.h is not part of the Microsoft VisualC++ 6.0 product, and neither is path_md.h. I'm not sure why you're wanting to compile this particular piece of code, but it appears you haven't gotten all the files. To get the code to compile in VC6, do the following:

- comment out #include "sys.h"
- comment out #include "path_md.h"
- near the end, change the line
FreeLibrary(handle);
to
FreeLibrary((HINSTANCE)handle);
- near the end, change the line
return GetProcAddress(handle, name);
to
return GetProcAddress((HINSTANCE)handle, name);
- add a main function if you haven't done so already, like this:
int main()
{
return 0;
}


This code looks like it's for managing the loading of .dlls. Is this some sample code you were just trying to compile, or is there a reason you need this particular code to build in VC6?

------------------
Brian

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
quote:
Originally posted by BrianT:

This code looks like it's for managing the loading of .dlls. Is this some sample code you were just trying to compile, or is there a reason you need this particular code to build in VC6?

[/B]


Yes the reason is that i'm building J2se (Java thing). So I didn't write it.

------------------
Love, Life and Linux

CoolJ

Member

Posts: 354
From: ny
Registered: 07-11-2004
wow, building J2SE build looks really involved, I would start with these instructions, though:
http://java.sun.com/j2se/1.5.0/scsl/build-windows-i586.html

I guess they don't want to make it too easy since you are compiling your own version of their java machine!

goop2

Member

Posts: 1059
From:
Registered: 06-30-2004
Must be nice seeing a bunch of garble and knowing what it means *sigh*

------------------
------------------------

I dont like siggys. They are to hard to think up :(

Briant

Member

Posts: 742
From: Stony Plain, Alberta, Canada
Registered: 01-20-2001
quote:
Originally posted by Goop2:
Must be nice seeing a bunch of garble and knowing what it means *sigh*

It's just a matter of learning the basic syntax. But I know what you mean - I feel the same way when I look at Perl and other languages.

------------------
Brian

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
Well, I noticed that the .h files are in the same folder as the source code. Some time's the source code asks for a .h file thats not in the folder.

So would removing all the includes really help, or really mess things up?

------------------
Love, Life and Linux