Solved

how to link library

Posted on 2004-10-08
5
236 Views
Last Modified: 2010-04-22
hello, all,
 
  i have a library "LibFirst.a", saved in "./Lib", and a source file saved in "./Cpp", is it possible to link them into an exe, how the command look? By the way, i am going to use g++.

Thanx in advance

kim
0
Comment
Question by:kim_wei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:stefan73
ID: 12257906
Hi kim_wei,
Yes, like

g++ -L./Lib ./Cpp/your_source.cpp -o your_binary -lFirst

Be careful that libararies start with "lib", not "Lib". Linux is case-sensitive with file names!

Cheers!

Stefan
0
 

Author Comment

by:kim_wei
ID: 12274375
hello, stefan,

  thanx a lot, however, i just forgot to mention that in the cpp file is there a header file included "Child.h", which is saved in "./Inc", i did try several commands like following, they did not seem to work, any help?

1.)
g++ -I./Inc -L./Lib ./Cpp/Main.cpp -o test -Imy

2.) g++ -L./Lib ./Inc ./Cpp/Main.cpp -o test -Imy

kim
0
 
LVL 4

Expert Comment

by:pankajtiwary
ID: 12283556
Hi kim_wei,

Just like you tried -L flag for library, just try -I for include files.

g++ -I./Inc -L./Lib ./Cpp/your_source.cpp -o your_binary -lFirst

Have fun!!!
0
 
LVL 4

Accepted Solution

by:
pankajtiwary earned 35 total points
ID: 12283561
Sorry, just a bit late...:-))
0
 
LVL 12

Expert Comment

by:stefan73
ID: 12285277
yes, with an exact copy & paste of my text :-/
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

636 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