Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Unresolved External using CPort in CBuilderX

Posted on 2004-11-18
11
Medium Priority
?
698 Views
Last Modified: 2008-01-09
Anyone have any ideas how to resolve the following errors so I can compile my program successfully.
I know this is some type of linker problem, but if someone could give details on how this should be set up please let me know!!!!

Using the CPort Library for serial communications, I obtain the errors.

ilink32 -D -ap -Tpe -x -Gn -v -LC:\CBuilderX\lib  c0x32.obj windows\Debug_Build\untitled.obj,"C:\Documents and Settings\Administrator\cbproject\motor\windows\Debug_Build\motor.exe",,cw32.lib import32.lib,,
Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland
Error: Unresolved external '_ComClose' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\CBPROJECT\MOTOR\WINDOWS\DEBUG_BUILD\UNTITLED.OBJ
Error: Unresolved external '_ComOpen' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\CBPROJECT\MOTOR\WINDOWS\DEBUG_BUILD\UNTITLED.OBJ
Error: Unresolved external '_comopen_errno' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\CBPROJECT\MOTOR\WINDOWS\DEBUG_BUILD\UNTITLED.OBJ
Error: Unresolved external '_ComHandshake' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\CBPROJECT\MOTOR\WINDOWS\DEBUG_BUILD\UNTITLED.OBJ
Error: Unresolved external '_ComPuts' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\CBPROJECT\MOTOR\WINDOWS\DEBUG_BUILD\UNTITLED.OBJ
 ILINK32 exited with error code:
 2 ILINK32 exited with error code: 2


Regards,Nick.
0
Comment
Question by:nickypp
  • 6
  • 5
11 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 12616902
Have you added the related library to your project (I assume it's called 'cport.lib')? This should solve your problem.
0
 

Author Comment

by:nickypp
ID: 12616925
Yes I have added "cports.lib" to the project already. Any more ideas????
0
 
LVL 86

Expert Comment

by:jkr
ID: 12616954
Are you sure? It does not appear in the above linker command line. It could also be a problem with the C++ name mangling - try

extern "C" {
#include "cport.h"
}

to turn that off for the functions in that header file.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:nickypp
ID: 12617183
I really dont know what to do. I cant add the cports.lib to the linker upon compile. How do I do that?

0
 
LVL 86

Expert Comment

by:jkr
ID: 12617238
You could add

#pragma link "cport.lib"

to your code.
0
 

Author Comment

by:nickypp
ID: 12617251
No luck on that count either! I am installing Open Watcom C++, to see if I can work with that.
0
 

Author Comment

by:nickypp
ID: 12617392
AAAh ok, getting somewhere. Now I have another problem!

ilink32 -D -ap -Tpe -x -Gn -v -LC:\CBuilderX\lib  c0x32.obj windows\Debug_Build\untitled.obj,"C:\Documents and Settings\Administrator\cbproject\ConsoleApp2\windows\Debug_Build\ConsoleApp2.exe",,cw32.lib import32.lib,, Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland
Fatal: Unsupported 16-bit segment(s) in module COM


any ideas here?
0
 
LVL 86

Expert Comment

by:jkr
ID: 12617446
>>Fatal: Unsupported 16-bit segment(s) in module COM

Where did you download 'CPort' from? It seems that you have a 16bit lib there...

BTW, if you don't necessarily *have* to use CPort, be sure to check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwbgen/html/msdn_serial.asp ("Serial Communications in Win32")
0
 

Author Comment

by:nickypp
ID: 12617543
downloaded from programmers heaven. I would prefer to use CPort if poss.
0
 
LVL 86

Expert Comment

by:jkr
ID: 12617786
Great god, have you checked the date of the .lib file in the archive? That is 9-Apr-1993. The only 32bit systems at that time were OS/2 and NT3.1. IOW: I strongly doubt that you'll be able to use it...
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 12617917
BTW, you also might find http://www.traverse.com/people/poinsett/bcbcomm.html ("Serial Communication with Borland C++ Builder") useful
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question