BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help wanted for compile and link

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools)
View previous topic :: View next topic  
Author Message
Chip Ling
Guest





PostPosted: Sat Dec 13, 2003 12:09 am    Post subject: Help wanted for compile and link Reply with quote



Dear all,

I have problem when doing compile and link by using the command line BCC
5.5.

I wrote a simple testing program as below

// test.cpp program
#include <iostream.h>
#include <windows.h>
#include <sql.h>
#include <sqlext.h>

void main()
{
HENV env_handle;

if (SQLAllocEnv(&env_handle) != SQL_SUCCESS)
{
cout << "SQLAllocEnv fail" << endl;
exit(-1);
}
else
{
cout << "SQLAllocEnv success" << endl;
}

SQLFreeEnv(env_handle);
}

At first, I invoke the compiler using the following command

bcc32 -P -Ic:bcc55include -Lc:bcc55lib -c test

The compile went thru successfully but during the linking time, the
linker gave me two error messages.

Unresolved external 'SQLAllocEnv' referenced from test.obj
Unresolved external 'SQLFreeEnv' referenced from test.obj

So I separate the compile and link step as below

bcc32 -P -Ic:bcc55include -c test

Then I invoke the linker as below

ilink32 -Lc:bcc55lib;c:bcc55libpsdk test,,,,,

It completed successfully.

But when I run the executable, it gives me a message window saying "test
is not a valid windows NT application".

I tried it on another machine running Win98 and get the same result.
(the error message is difference but I don't remember what it is now)

Anyone can help???

Rgds,
Chip

Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Sat Dec 13, 2003 2:43 am    Post subject: Re: Help wanted for compile and link Reply with quote



Quote:
bcc32 -P -Ic:bcc55include -Lc:bcc55lib -c test

The -I and -L options should not be needed
Check that you have created the bcc32.cfg files in the compiler's
BIN directory in the way the readme.txt described.

Get rid of the -P option. It does nothing here. *.CPP files are already
compiled as C++

The option to tell it what to make is missing (console mode or GUI mode
EXE or a DLL).


A workable compiler command line might be

bcc32 -WC -c test

Quote:
Unresolved external 'SQLAllocEnv' referenced from test.obj
Unresolved external 'SQLFreeEnv' referenced from test.obj

Those functions are in a library. You did not tell the compiler to use that
library. Put the library name, complete with .LIB extension, on the
command line.

Quote:
ilink32 -Lc:bcc55lib;c:bcc55libpsdk test,,,,,

The -L option should not be needed.
Check that you have created the ilink32.cfg file in the compiler's
BIN directory.

The linker option to tell if it is an EXE or DLL and the option to tell if
it is a console mode (text mode) or GUI mode (graphical) program is
missing. Add /Tpe/ap to the command line to the left of the first file
name.

The compiler startup code is missing. For a console mode program
that is c0x32.obj. It should be the first object file listed for the
linker.

The library with the SQL functions you used is missing. The import
library for what Windows provides is missing. The compiler's runtime
library is missing.

Assuming the library with the SQL functions you used is sql.lib, a
workable command line might be:

ilink32 /Tpe/ap c0x32 test,test,,sql import32 cw32

For help on how to use the compiler and its options
Start the help
Click on the Index tab
Type BCC32 into the edit control
Click the Display button

For help on the linker repeat the above with ILINK32 in the edit control.

.. Ed

Quote:
Chip Ling wrote in message
news:3FDA58C5.4BC0655F (AT) yahoo (DOT) com...

I have problem when doing compile and link by using the command
line BCC 5.5.

I wrote a simple testing program as below

// test.cpp program
#include #include #include #include
void main()
{
HENV env_handle;

if (SQLAllocEnv(&env_handle) != SQL_SUCCESS)
{
cout << "SQLAllocEnv fail" << endl;
exit(-1);
}
else
{
cout << "SQLAllocEnv success" << endl;
}

SQLFreeEnv(env_handle);
}

At first, I invoke the compiler using the following command

bcc32 -P -Ic:bcc55include -Lc:bcc55lib -c test

The compile went thru successfully but during the linking time, the
linker gave me two error messages.

Unresolved external 'SQLAllocEnv' referenced from test.obj
Unresolved external 'SQLFreeEnv' referenced from test.obj

So I separate the compile and link step as below

bcc32 -P -Ic:bcc55include -c test

Then I invoke the linker as below

ilink32 -Lc:bcc55lib;c:bcc55libpsdk test,,,,,

It completed successfully.

But when I run the executable, it gives me a message window
saying "test is not a valid windows NT application".

I tried it on another machine running Win98 and get the same result.
(the error message is difference but I don't remember what it is now)



Back to top
Chip Ling
Guest





PostPosted: Mon Dec 15, 2003 7:07 pm    Post subject: Re: Help wanted for compile and link Reply with quote



Dear Ed,

Thanks for the info and now the compiler and linker is working. Here is what I
use.

For compile and link together, I use
bcc32 -Ic:bcc55include -Lc:bcc55lib;c:bcc55libpsdk test odbc32.lib

For compile and link does it separately
bcc32 -Ic:bcc55include -c test
ilink32 -Lc:bcc55lib;c:bcc55libpsdk c0x32 test,test,,odbc32 import32
cw32

Thanks for your help again.

BTW where can we find those info like we need to put c0x32, import32 and cw32 in
order to make the linker works.

Rgds,
Chip


"Ed Mulroy [TeamB]" wrote:

Quote:
bcc32 -P -Ic:bcc55include -Lc:bcc55lib -c test

The -I and -L options should not be needed
Check that you have created the bcc32.cfg files in the compiler's
BIN directory in the way the readme.txt described.

Get rid of the -P option. It does nothing here. *.CPP files are already
compiled as C++

The option to tell it what to make is missing (console mode or GUI mode
EXE or a DLL).

A workable compiler command line might be

bcc32 -WC -c test

Unresolved external 'SQLAllocEnv' referenced from test.obj
Unresolved external 'SQLFreeEnv' referenced from test.obj

Those functions are in a library. You did not tell the compiler to use that
library. Put the library name, complete with .LIB extension, on the
command line.

ilink32 -Lc:bcc55lib;c:bcc55libpsdk test,,,,,

The -L option should not be needed.
Check that you have created the ilink32.cfg file in the compiler's
BIN directory.

The linker option to tell if it is an EXE or DLL and the option to tell if
it is a console mode (text mode) or GUI mode (graphical) program is
missing. Add /Tpe/ap to the command line to the left of the first file
name.

The compiler startup code is missing. For a console mode program
that is c0x32.obj. It should be the first object file listed for the
linker.

The library with the SQL functions you used is missing. The import
library for what Windows provides is missing. The compiler's runtime
library is missing.

Assuming the library with the SQL functions you used is sql.lib, a
workable command line might be:

ilink32 /Tpe/ap c0x32 test,test,,sql import32 cw32

For help on how to use the compiler and its options
Start the help
Click on the Index tab
Type BCC32 into the edit control
Click the Display button

For help on the linker repeat the above with ILINK32 in the edit control.

. Ed



Back to top
Chip Ling
Guest





PostPosted: Mon Dec 15, 2003 7:24 pm    Post subject: Re: Help wanted for compile and link Reply with quote

Hi Ed,

I do some search on the bcc55 lib folder in my machine, I found that besides
c0x32, they have a lot similar obj files like c0d32, c0d32w, c0d32x, c0s32,
c0w32, c0w32w, c0x32w etc.

And also within the psdk library folder, I found quite some lib files there. How
can I know what functions are contained inside those lib files? Any
documentation I can search? This time I use the ODBC32.lib by guessing since I
know I was using the ODBC related function.

Rgds,
Chip

"Ed Mulroy [TeamB]" wrote:

Quote:
bcc32 -P -Ic:bcc55include -Lc:bcc55lib -c test

The -I and -L options should not be needed
Check that you have created the bcc32.cfg files in the compiler's
BIN directory in the way the readme.txt described.

Get rid of the -P option. It does nothing here. *.CPP files are already
compiled as C++

The option to tell it what to make is missing (console mode or GUI mode
EXE or a DLL).

A workable compiler command line might be

bcc32 -WC -c test

Unresolved external 'SQLAllocEnv' referenced from test.obj
Unresolved external 'SQLFreeEnv' referenced from test.obj

Those functions are in a library. You did not tell the compiler to use that
library. Put the library name, complete with .LIB extension, on the
command line.

ilink32 -Lc:bcc55lib;c:bcc55libpsdk test,,,,,

The -L option should not be needed.
Check that you have created the ilink32.cfg file in the compiler's
BIN directory.

The linker option to tell if it is an EXE or DLL and the option to tell if
it is a console mode (text mode) or GUI mode (graphical) program is
missing. Add /Tpe/ap to the command line to the left of the first file
name.

The compiler startup code is missing. For a console mode program
that is c0x32.obj. It should be the first object file listed for the
linker.

The library with the SQL functions you used is missing. The import
library for what Windows provides is missing. The compiler's runtime
library is missing.

Assuming the library with the SQL functions you used is sql.lib, a
workable command line might be:

ilink32 /Tpe/ap c0x32 test,test,,sql import32 cw32

For help on how to use the compiler and its options
Start the help
Click on the Index tab
Type BCC32 into the edit control
Click the Display button

For help on the linker repeat the above with ILINK32 in the edit control.

. Ed


Back to top
Ed Mulroy [TeamB]
Guest





PostPosted: Mon Dec 15, 2003 8:31 pm    Post subject: Re: Help wanted for compile and link Reply with quote

It is good to hear that you have gotten it working.

Quote:
For compile and link together, I use
bcc32 -Ic:bcc55include -Lc:bcc55lib;c:bcc55libpsdk test
odbc32.lib


Get rid of this: -Ic:bcc55include -Lc:bcc55lib;c:bcc55libpsdk
If afterwards it does not work, then fix the bcc32.cfg file so the compiler
is
properly installed.

Quote:
For compile and link does it separately
bcc32 -Ic:bcc55include -c test
ilink32 -Lc:bcc55lib;c:bcc55libpsdk c0x32 test,test,,odbc32
import32
cw32

Same comment for the bcc32 line.

For the ilink32 line, change it to
ilink32 /Tpe/ap c0x32 test,test,,odbc32 import32 cw32

If afterwards it does not work then fix the ilink32.cfg file so the linker
is properly installed.

The /Tpe and /ap options I added are the same options I said to add in my
previous reply.

Quote:
BTW where can we find those info like we need to put
c0x32, import32 and cw32 in order to make the linker works.

Read the tools help file entry on ILINK32 as I described in my previous
reply.

For what the names of the startup code and library files, run bcb5rtl.hlp
and search for the string
static runtime libraries

If you don't have that help file then you have not downloaded the help files
for the compiler. Go here and get them:
http://tinyurl.com/2zri
or, in its long form
http://info.borland.com/techpubs/bcppbuilder/v5/updates/pro.html

Many of the files pertain to things only found in the commercial
distribution of the compiler. I think the ones which most pertain to you
are B5RTL, B5LANG, B5SCL and B5MS (each with an extension of .ZIP).

.. Ed

"Chip Ling" <chip_ling_vb (AT) yahoo (DOT) com> wrote

Quote:
Dear Ed,

Thanks for the info and now the compiler and linker is working.
Here is what I use.

For compile and link together, I use
bcc32 -Ic:bcc55include -Lc:bcc55lib;c:bcc55libpsdk
test odbc32.lib

For compile and link does it separately
bcc32 -Ic:bcc55include -c test
ilink32 -Lc:bcc55lib;c:bcc55libpsdk c0x32 test,test,,odbc32
import32 cw32

Thanks for your help again.

BTW where can we find those info like we need to put c0x32,
import32 and cw32 in order to make the linker works.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Command Line Tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.