Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:

When I try to compile a C Program in VS.NET 2005, I get the below mentioned errors:

Linking...
btrapi.obj : error LNK2019: unresolved external symbol _WBRQSHELLINIT@4 referenced in function _RQSHELLINIT@4
btrapi.obj : error LNK2019: unresolved external symbol _BTRCALL@28 referenced in function _BTRV@24
btrapi.obj : error LNK2019: unresolved external symbol _BTRCALLID@32 referenced in function _BTRVID@28

fatal error LNK1120: 3 unresolved externals

Its been frustating for the past 1 week and this error has wasted us a lot of time. Any kind of help is really appreciated. Also let me know if you would require any additional information.

Posted

As I said previously you have some libraries missing from your build settings. Check where you have stored the BTRIEVE library files and either add the path to the Linker properties for the project, or add it to the Lib directories for Visual Studio.

 
Share this answer
 

It looks as if you have some objects or libraries missing from your project. Are you trying to use some third party product?

 
Share this answer
 

Hi Richard,

My program is communicating with the BTRIEVE APIs to access the flat files.

Summary of the problem:
We have some exisiting programs written in MC6 (Microsoft C). We have to run (compile) these existing C programs in the VS.NET 2005 environment.

Also we are using Pervasive.SQL V8 / BTRIEVE APIs for the connections with the flat files because the existing application interacts with the BTRIEVE databases, which is flat files.

We are facing problems during the compilation process. We have to link the existing programs with the obj file "btrapi.obj", which is meant for accessing the BTRIEVE files. So ultimately, we are having problems while it is linking.

The build log has been attached along with this mail and the errors are listed in the attached build log. We got this build log as a result of the compilation of the existing C program in VS.NET 2005. Pls let me know if you would any additional information.

We wanted help in resolving the problem attached in the BuildLog.txt file.

Steps followed for the compilation:

1) In the Developer Studio programming environment, choose New from the File menu.
2) In the New dialog, on the Projects tab, do the following:
Set the type to Console Application.
Set the Name to Sample.
Set the location to your desired directory.
Click OK.
3) Choose Settings from the Project menu. On the C++ tab, do the following:

In the Preprocessor category, add BTI_WIN_32 in the Preprocessor Definitions box and add the current directory (.) in the Additional Include Directories box.
In the Code Generation category, set the Structure Member Alignment to 1 Byte.
Click OK.
4) Choose Rebuild All from the Build menu. Microsoft Visual C++ builds the program and places the exe in the project file directory.

We had tried many option through google search, but we are not able to get a breakthrough.

Any help is really appreciated....

 
Share this answer
 

The following settings has been done, which made the compilation smoother and it worked fine.

Need to do couple of settings in Visual Studio.

  • Go to the Project properties window, select C/C++ -> General.
  • Add the current directory (.) in the Additional Include Directories box.
  • In the Preprocessor category, add BTI_WIN_32 in the Preprocessor Definitions box.
  • In the Code Generation category, set the Structure Member Alignment to 1 Byte.
  • In the Advanced, Select “Compile as C Code (/TC)” from the “Compile As” drop down.
  • The below is a very important setting. Need to add the library file in the Input option in the Linker section. In our case, we added "w3btrv7.lib".
  • The build the project to generated the EXE.

One of the major problem regarding the compilation of C program in VS.NET got resolved.

But we got into another problem. The EXE generated works fine in my machine. My machine has BTRIEVE10 client installed, Win XP as the operating system and Visual Studio .NET 2005 installed.

The same EXE is not working fine in another PC with the same configuration. The following is the error message that i am getting:

"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

This is now really a burning issue and we are under so much of heat. Any help is really appreciated.

The following are the links that i am currently referring:

http://blog.truebob.com/2007/12/system-cannot-execute-specified-program.html

http://support.microsoft.com/kb/q241712/

http://www.codeguru.com/forum/showthread.php?t=424814

But no luck......

 
Share this answer
 
v2
The Problem - as mentioned allready - are the missing btrieve functions. Your .obj probably exports or imports the functions incompatible to your compiler.
So for example if you use load library and then getProcAdress you will probably use GetProcAddress (dllinst, "BTRCALL"). Now .net is might be looking for _BTRCALL@28 or BTRCALL@28 or _BTRCALL (you see the little difference?).

To solve the issue you can either rebuild your .obj using the same import/export type or you could use a wrapper to call the BTRIEVE API. There are a free Wrapper Framework for Btrieve at www.dbcoretech.com. In this post the programmer also shows how to export functions to be used with other compiler as well (he uses pragma exporting). Check it here: http://www.dbcoretech.com/?p=144[^]:cool:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900