473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to create a .h of a .LIB in C++ (IDE:Visual Studio 6)

11
Hi all, my first topic here to ask help or informations!
I have to create a wrapper (.h) for a .lib using Visual Studio 6.

Here the question:
I have only the compiled .lib (nothing else).
I have to create a .h for that .lib with some methods contained in the .lib, so both will be included in another project and can be used by the users.
Is it possible? How can I create the .h? (a short tutorial??)

I'm going crazy!!
Mar 30 '07 #1
7 2206
RedSon
5,000 Expert 4TB
When you create a new project it typically consists of a header file and a code file or implementation. When you build your project it creates a .lib (unless you have it set to create a .dll or .exe). If you want to use your lib on a project all you need to do is add the proper #include at the top of your new code file. And you must also make sure that your linker settings know where your previously created .lib is.
Mar 30 '07 #2
Arks
11
For example, at the top of my .h, I have to write:

#include "MyLib.lib"

but how can I call the method of the .lib??

I.E.: in the .lib I have isUsable(), in the .h can I write something as.....:

bool flag == true;
if (flag)
std::cout<< isUsable() << std::endl
Mar 30 '07 #3
RedSon
5,000 Expert 4TB
You use it like however you wrote it. If its static then you do something like MyLib.method()

Or if its in a class then you do MyLibClass.method()

Its the same as using any other .h file in any other project. Don't be intimidated or confused by it being a .lib.
Mar 30 '07 #4
Arks
11
Sorry, but I'm really stupid atp.
In my test.h, where I want to create a wrapper, I wrote:

#include "MyLib.lib"
or
#include "c:.................MyLib.lib"

\\\\\\\ERROR///////
error C2143: syntax error : missing ';' before '!'
error C2018: unknown character '0x60'
and so on......

could be that the .LIB is created on Visual Studio 2005 and I want to create a wrapper using Visual Studio 6?


instead if I do this:

MyLib.Method();

error C2065: 'MyLib' : undeclared identifier
error C2228: left of '.Method' must have class/struct/union type
Mar 30 '07 #5
RedSon
5,000 Expert 4TB
You should add MyLib.h or MyLib.cpp and let the linker pick the right .lib. You also don't need to put the full path you can just put the library in and tell in your linker config settings where the lib is.
Mar 30 '07 #6
Arks
11
Ok restart from 0.

I have MyLib.lib, it's a result of a compilation of a project that a friend of mine gave to me.
I have to create a wrapper of this .lib so I can include the wrapper and the .lib in other projects and the people can use my work.

I created with the wizard a console application called "TestProject" in visual studio 6, then I opened the "Properties" of "TestProject" and I wrote in the "Linker": MyLib.lib, now:

How can I create the wrapper that works with MyLib.lib?
Mar 30 '07 #7
RedSon
5,000 Expert 4TB
It doesnt work like that. When you create a lib you make a .h and a .cpp then when you make the project part of the output of that build process is the .lib. So you then distribute the .lib and the .h to everyone. That way people can use your .lib with out worrying about the implementation details of the .lib and all they will have is the interface to the lib which is the .h. All you need to do is include the .h into your file and make sure that the .lib is on your linker's path.
Mar 30 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Matt Slay | last post by:
In what application does one write all these ASP programs? NOTEPAD? All the examples of code I see are all just text. Is there not an IDE interface, such as what VB or Visual Foxpro has for...
3
by: Crusell | last post by:
Hi, I'm having some serious issues with the 1.1 IDE (Visual Studio 2003) and thinking of moving to the 2.0 beta IDE. My question is: Do I have to migrate my existing 1.1 code to 2.0 standards to...
2
by: Keith Jakobs, MCP | last post by:
Greetings: I had seen several posts around the Internet about this issue from a few months back, but have been unable to find a resolution ... I have a user who is trying to get started with...
22
by: smartwolf agassi via DotNetMonster.com | last post by:
I'm a C# language learner. I want to know which IDE is better for C# programing, Borland C#Builder or VS.net 2003? -- Message posted via http://www.dotnetmonster.com
3
by: Joseph Geretz | last post by:
Our application is primarily VB6, however we are migrating toward .NET and a newer architecture. For the time being though, we're stuck with a hybrid approach with our ActiveX client application...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
5
by: ....DotNet4Ever.... | last post by:
OK here the big problem... My organization is not yet ready to move to .NET 3.5 and even .NET 3.0 is still seen as something "not quite stable" (don't ask me why). For those reasons the project...
13
by: miztaken | last post by:
Hi, My C# application have a following code to create an instance of Visual Studio. System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE. 8.0"); Object obj =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.