Programming :: C Header Files And Object Files ?
Sep 18, 2010
When is it good to use separate translation units and object files and link them into the main C program, and when is it good to include the header files in the main C program? I don't understand if most people include header files or if most people just link in object files and use their contents in the main program. It's sort of a simple question, but it's confusing to me and that's why I need help with it. I sort of don't understand the difference, or if there's really no difference other than the way the final result is achieved, which way is better or preferred, etc...
For example:
Code:
or:
Code:
Simple explanation of the difference? or which one is preferred or better? I've read a little on the ELF format... so is there no difference in the end result? It's just a matter of preference or necessity, and where the information is to begin with?
View 9 Replies
ADVERTISEMENT
Jun 16, 2010
I want to use kmalloc() to allocate contiguous memory on ram. But I can not seem to find the required header file(s) like linux/slab.h. I suppose I do not have the required library and I certainly do not know what and where to look.
View 14 Replies
View Related
Mar 10, 2010
I have been a predominant Windows user for a long time but shifted to Ubuntu recently. I was just trying out a few basic C functions when i realized that the "conio.h" header file isn't included in the libraries and therefore i was unable to use the "clrscr()" function.
I downloaded a tarball which contained the necessary library and header files including conio.h. Once extracted, i specified the location and included in the program as " #include "path to the header file" ".
I still didn't call the "clrscr()" function, and it compiled successfully. Next i edited the program to call that function and it gave the following error...
How i can add new libraries in the future?
View 14 Replies
View Related
Feb 14, 2011
New to programming having issues reference header files.
Not sure how to put the fomula in headers below:
Program
using namespace std;
View 7 Replies
View Related
Feb 26, 2010
I have written a simple library and ended up with a .so file. I have a header file from writing the code that describes how to use the functions in the source code I have written. I think this .h files needs to be available to other programs that access this code.
I have seen lots of tutorials on how to copy the .so file to the relevant directories and make links with the version number. What I can't find is where to put the header file so that any programs I write to use my new library can access the header.
Hope this makes sense. For example, I might use <stdio.h> normally, I will need to access <mylibrary.h> once mylibrary.so is loaded (as far as I understand!)
It's weird, I've been using C compilers for embedded processors over ten years now and never given a second thought to how libraries and headers work behind the scenes!
View 6 Replies
View Related
Nov 1, 2010
Say I have a directory structure:
And other.c has:
How do I setup the CMakeFiles.txt files in each directory, so the executable "program" (from program.c) is created.
Currently I get the error:
View 1 Replies
View Related
Jan 29, 2010
I installed Codeblocks and build some programs, but I have two questions:1. Where are my header files placed, since I don't know where codeblocks is installed. Soemetimes I have to remove header file extension (.h) to be able to compile some source. I use gcc as setting for codeblocks to compile and build programs.2. Plugins for Codeblocks can be installed, but when browse codeblocks's wiki I can't find download links neither developer pages
View 3 Replies
View Related
Oct 20, 2010
What flags do you have to pass to valac to compile code into a shared library (file extension .so)?
View 1 Replies
View Related
Apr 3, 2011
I have C++ source code(*.cpp) files that expects it's header files in System's include folder which is/usr/include.The cpp files has include lines like this:
Code:
#include <some.h>
#include <another.h>
[code]...
View 3 Replies
View Related
Mar 9, 2009
I have created a simple test class - Mortgage, with the class declaration in the .h file and the class's methods defined in the .cpp file. (mortgage.h && mortgage.cpp, respectively) Straight up C++ 101 as far as I can tell. I instantiate the class in the main() function, which is defined in practice.cpp. Using Geany on Ubuntu, both the practice.o and mortgage.o files are created, but then I get a linker error: undefined reference to class::functionName
I get it for each function. If the mortgage.cpp file is foremost in the editor when I click "build", then I get the undefined reference to main() error, if practice.cpp is foremost (where the main() function is) then I get undefined reference to Mortgage::Mortgage(), and all the rest of the functions defined for that class. How do I get the linker to know where my object files are so it will link them in? Or is the problem somewhere else entirely?
View 8 Replies
View Related
Apr 12, 2011
I tried to update the header files manually in the include folder, because I thought that I needed to have windows.h etc, but now nothing compiles and I get a good 80 errors for even hello world. I have tried removing g++ and all related packages, deleting the header files folder and reinstalling, but it reinstalls the broken files. Any way of restoring the originals without reinstalling ubuntu?
View 1 Replies
View Related
Dec 28, 2009
I've installed Fedora 12 (KDE version) on VMware workstation running under Windows 7.
I've been able to configure the VMware tools fine up until this point:
Code:
What is the location of the directory of C header files that match your running kernel? After some searching online I deduced I should install all of the latest updates and kernel-devel.
I then nuked the previous VMware tools install and started over with it again, but alas, no directory I try works (i.e. /usr/src/kernels/, /usr/src/kernels/2.6.31.5-127.fc12.i686/ and so forth).
View 8 Replies
View Related
Aug 27, 2010
I'm trying to add a header to many .cpp files in a directory (or directory tree).
My attempt was:
Code:
If I put part of the command inside quotes the substitution occurs, but then I get other errors like:
Code:
cat:
No such file or directory
I could just write a small program to do it.
View 3 Replies
View Related
Jan 26, 2010
I am new to linux. I want to use a header file asm/msr.h. But the /usr/include does not contain the header file that I want. Can I just copy the whole asm directory into the directory /usr/include, and overwrite the old one?
View 2 Replies
View Related
Jan 30, 2011
I'm trying to install vmware tools in mint.
All goes well until I get to this -
What is the location of the directory of C header files that match your running kernel? [usr/src/linux/include]
When installing the vmware tools it says to just hit enter and the default will be used.
Hitting enter just keeps giving me the error message- The path "usr/src/linux/include" is not an existing directory.
View 14 Replies
View Related
Feb 12, 2011
I've started using the huge.s kernel and when i try to compile packages slackware complains about kernel headers but all i see is the smp header files on the slackware discs ?
View 2 Replies
View Related
Jan 10, 2010
i was trying to install iftop using make installso when i ran /configureit told me that some header files are missing and some modules aaare also missingis there a way to search for the missing header files on the internet and missing modules n the internet
View 1 Replies
View Related
Jan 13, 2011
I need to install some module which needs to be interated into OS's.
It asks me: "What is the location of the directory of C header files that match your running kernel? "
I know that I need kernel-devel package and I installed this yum install kernel-devel after that I have this /usr/src/kernels/2.6.32.26-175.fc12.i686/include/
Now when I run configuration it does not work
Does it mean that I need to update the kernel so that it matches to the kernel-devel module available in the net?
View 4 Replies
View Related
Feb 13, 2010
I am using Ubuntu 9.04 with kernel version 2.6.28-11-generic.I want to compile the foll. file but i get <linux/slab.h> no such file or directory.
The kernel headers are installed in my system at /usr/src/linux-headers-2.6.28-11-generic/ directory. During compilation i specified as follows:
Why gcc is unable to find the linux/slab.h header file?
View 1 Replies
View Related
Jan 5, 2010
While setup of vmware on CentOS5.4 i am facing the below error.What is the location of the directory of C header files that match your runningkernel? [/usr/src/linux/include]
View 5 Replies
View Related
Dec 24, 2009
I am using Fedora 12 with VMWare Player 3. I want to install the vmware tools. To get them properly working i need the location of the kernel header files. In which directory are they usually stored?
View 2 Replies
View Related
Feb 3, 2011
I just had a hard drive failure on my mythtv box that I had been running F14 on. I reinstalled F14 and just got about everything up and running like normal again except that I upgraded the kernel by mistake when I was upgrading everything else to current levels. The problem is that I run a hauppauge pvr150 on this mythtv box, and the code for capturing on this card is broken on the latest kernel version. I have the kernel headers and development files installed for the newest kernel that I can't really use, but I didn't install the kernel headers for the older kernel before the upgrade. Now, I am looking for a way to forcefully install the older kernel development files so that I can compile my the proprietary nvidia drivers against it for my adapter. I downloaded the rpm files from the fedora 14 repository directly. Is there an option for rpm that I can use to force the installation?
View 2 Replies
View Related
Jan 4, 2011
I am running VMware inside windows 7 64bit.I have installed ubuntu 2.8 ultimate edition on a 20gb partition and used 1gb of ram....everything is updated etc and running good. I checked in the VMware tools bar the entity tab,and says tools is not installed.
So when i run the install everything goes well untill it reaches the point where it says "What is the location of the directory of C header files that match your running kernel?
I have tried everything,different tutorials,installed a build package etc and it still asks for the directory. here is the uname r output :
uname r : 2.6.35-24-generic
View 7 Replies
View Related
Jun 5, 2011
I'm working with a GuruPlug...maybe you've heard of them.I'm trying to get EasyCap DC60 drivers installed on it(easycap_dc60.0.9.tar.gz), but in the README file I see that the "header files" must be present.nfortunately they are not. This little wall wart runs Debian/Lenny, probably some server oriented build.uname -r reports:2.6.32-00007-g56678ecIt boots to RunLevel 2 and stays there, incidentally.I tried apt-get install linux-headers-$(uname -r) but I am told "file not found" or something similar
View 5 Replies
View Related
Aug 12, 2010
I have a program consists of header files, .cpp, .c, a Makefile and need to include the problem instances file (.tim).May i know how to compile and run them? From google, i have heard bout the command make.
View 6 Replies
View Related
Jan 27, 2011
Development Package X has a header file that includes another header file, provided by package Y. But package X doesn't have the requires set to dependupon package Y.
Do you know any tools to check which packages has missing dependencies ?
View 1 Replies
View Related
Nov 23, 2010
I am trying to configure VMWare tools to work with the linux-virtual kernel, but every time I supply the headers path to vmware-config-tools, it rejects it. What should I do to configure it?I am using the path:/lib/modules/2.6.35-23-virtual/build/includeBut I get the rejection message:The path "/lib/modules/2.6.35-23-virtual/build/include" is not valid.It works with the generic version, so what am I doing wrong?
View 2 Replies
View Related
Jun 9, 2010
Not I recently installed a package (Vision Egg) that requires the Open GL libraries and headers, specifically, gl.lib and gl.h. I used Synaptic to install nvidia-current and nvidia-current-dev and it now looks as if the required libraries (under different names) are installed in /usr/lib/nvidia-current and as if the required headers are in /usr/include/nvidia-current. I am a bit confused because I also have /usr/lib/nvidia and /usr/lib/nvidia-173.
The installation of Vision Egg fails with "cannot find GL/gl.h" and "/usr/bin/ld: cannot find -lGL"There is a related post a few years ago under thread 200901 but it relates only to a single file problem that is fixed manually. I'd rather avoid that because it looks like it is easily breakable.Is there a standard way --- that is, a method that does not require error-prone manually changing or linking a multitude of file names --- of ensuring that programs which require GL/gl.h actually find the correct nvidia header file and also that the link loader finds the GL libraries.
View 2 Replies
View Related
Jun 22, 2011
I installed BLAS using yum on my RHEL.
Code:
yum install blas
Also installed blas-devel
Code:
yum install blas-devel
There are shared objects in
/usr/lib/libblas.so.3
/usr/lib/libblas.so.3.0
[Code]...
But I can't find cblas.h file. Should I install something else to get the header file installed?
View 3 Replies
View Related
Apr 5, 2011
I've a source code of a program and I know that to compile and install that program I've to do:
./configure --prefix=/opt/test
make
make install
Now I want the program to look for dependent libraries and header files first in a non system folder. Now how can i instruct "configure" and "make" script to look for dependencies first in a different folder without editing configure and Makefile. And after these folders are searched for dependencies by the script it can look in system folder. Is there any environment variable that i can supply to "configure" and "make"? Will that work without any conflict? what are these environment variables? And also if I use these environment variables do I need to edit the source code files?
I mean do I need to change these lines
Code:
#include <test1.h> ...
to
Code:
#include "test1.h" ...
If yes then is there any other way to compile them without modifying the source code?
View 2 Replies
View Related