Subj : Re: strange Errors when compiling To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Thu Nov 06 2003 12:47 pm The function to use is putenv, not _putenv. The header file prototypes what the function JNI_CreateJVM is like but does not contain its code. The library contains its code but you have not told the linker to use that library. Put the library name on the linker command line just before import32 The Wd_Control_rec struct is declared as an instance of a structure, declared to have storage allocated to it. Since the header file is included by two source files, and an included header file is viewed by the compiler as part of the source file, then the object files for each of the two source files will each have storage declarations with the same name, a conflict. Change your header file to declare a structure type and if you need an instance of the structure then declare that instance in only one source file and provide an extern declaration for it in the header file. For instance: --------in the header file HEAD.H---------- struct Wd_Control_rec_type { int some_var; int another_variable; } extern struct Wd_Control_rec_type Wd_Control_rec; ----------------------------------------- --------in ONE source file--------- #include "head.h" struct Wd_Control_rec_type Wd_Control_rec; ----------------------------------------- --------in all other source files--------- #include "head.h" ----------------------------------------- There is one thing you must do. You are posting in the newsgroup for the old Borland C++ compiler but you are using the free command line tools, the command line tools from C++ Builder version 5. C++ Builder newsgroups all have the word 'cppbuilder' in their name. Your questions really should go into one of those groups so that more people familiar with the product will see them and possibly reply. I suggest that you use the following group: borland.public.cppbuilder.commandlinetools .. Ed > peter wrote in message > news:3faa7c35$1@newsgroups.borland.com... > > hi, i am compiling a program and with BCC32 and i am getting > these 3 strange errors/warnings: > MAKE Version 5.2 Copyright (c) 1987, 2000 Borland > ilink32 /Tpe/ap/c/x/Gn c0x32 adjfile surscf,adjfile,, noeh32 import32 cw32 > Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland > Error: Unresolved external '__putenv' referenced from C:\SURS\PROGRAM\C\ADJFILEJ\ADJFILE.OBJ > Error: Unresolved external 'JNI_CreateJavaVM' referenced from C:\SURS\PROGRAM\C\ADJFILEJ\ADJFILE.OBJ > Warning: Public symbol '_Wd_Control_Rec' defined in both module C:\SURS\PROGRAM\C\ADJFILEJ\ADJFILE.OBJ and C:\SURS\PROGRAM\C\ADJFILEJ\SURSCF.OBJ > > ** error 2 ** deleting adjfile.exe > > the strangeness is that > 1-it says _putenv is an unresolved external, but i have included > the header file in my code, which is the library this > function is contained in... > 2-it says JNI_CreateJVM is an unresolved external as well, but > that is in which i have also included in my code. plus, i > just compiled a similar program and made a call to this function. > this current program links to the same .lib, and includes the same > .h file in its code, so what gives? > 3-there is no '_Wd_Control_Rec' in my code, but there is a > 'Wd_Control_Rec' struct that is defined in my .h file (one that i > wrote myself) > i appreciate any help. thanks .