Programming :: Using Header Files - Reference And Put Formulas?
Feb 14, 2011New to programming having issues reference header files.
Not sure how to put the fomula in headers below:
Program
using namespace std;
New to programming having issues reference header files.
Not sure how to put the fomula in headers below:
Program
using namespace std;
i am a new programer in c i have write a simple app and i have a problem with combiling my program include one header file and 2 c
fun.h
#include<stdio.h>
void f();
/******EOF*******/
fun.c
#include"fun.h"
void f(){
[Code].....
I've been searching Google for a bit now, and either I'm too stupid or too tired to figure out the perfect search term for it.Im looking for a reference list of HTTP header info -- e.g, I have a program on Firefox that I can modify to send any header info i want "Safari, Mozilla, Internet Explorer" that sort of thing -- so a web site will believe Im using IE when in fact I am using Firefox.Does anyone have a reference of what the available "official" headers are? Also, a list of "OS header" responses would be nice, so I could fool something in believing I am a windows 3.1 machine.
View 4 Replies View RelatedWhen 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?
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 RelatedI 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?
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!
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:
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 RelatedI 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?
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]...
I am facing the problem of calling cfitsio library from C program in linux. when i am givingthe option "gcc -o CreateLevel1DataFitsFile CreateLevel1DataFitsFile.c -lm -lcfitsio
"i am getting following error
/usr/lib/../lib/gcc/i386-redhat-linux/3.4.4/../../../libcfitsio.a(getcolj.o)(.text+0x7065):/backup/Astrosat/learning/cfits/cfitsio/getcolj.c:3098: more undefined references to `__xtoll' follow
[code]...
Below I've presented the declaration, definition and the calling method of a function w.r.t pass by reference:
Declaration
Code:
void getUnpackedMsg (unsigned char &data, unsigned int numberOfBits);
Definition
line 278: Shown in RED
Code:
void packedMessage :: getUnpackedMsg (unsigned char &emptyArray, unsigned int numberOfBits)
{
...
...
printf ("
[code].....
I was trying to make a code for passing variables by reference..here's the code:
#include<iostream>
using namespace std;
void fun(int& ,int& );
int main(){
[Code].....
invalid initialization of non-const reference of type 'int&' from a temporary of type 'int*'
I wrote a small test program, and this is what happens when I try to compile it:
Code:
$ g++ -llua main.cpp
/tmp/ccHJ8HR3.o: In function `main':
[code]...
Code:
#include <string.h>
int main ()
{
stricmp ("anisha", "kaul");
return 0;
}
Code:
[code]....
When I compile my code in Linux (ATCA machine), I am getting the following error: /vobs/ims_do/lib/rhlinux/debug/libnem-dummy_td2.so: undefined reference to `__isoc99_sscanf'
The same code is being compiled in Solaris without any problems.
I'm using Linux and I have the following files:
The function F1() is declared in fileB.h and defined in fileB.cpp. I need to use the function in fileA.c, and so I declared the function as
However, during compilation, I got the error fileA.c: (.text+0x2b7): undefined reference to `F1'
When I try to compile my code using g95 or gfortran:
Code:
subroutine dipole_tilt(glong, glat, utsec, tau, day, hgraze)
implicit none
[code]....
I'm trying to do something very basic in bash. It's a kind of cross-reference matching between 2 files. I have a file1.txt. It's like this:
Code:
item1
item3
item4
...
I Have a file2.txt. It's like this:
Code:
item1 "Properties of item1"
item2 "Properties of item2"
item3 "Properties of item3"
item4 "Properties of item4"
item5 "Properties of item5"
...
My goal is to print out the lines in file2 that contains lines present in file1. I do:
Code:
for i in $(cat file1.txt); do grep $i file2.txt; done but I get no output. Will someone please tell me where am I mistaking?
I am trying to add some function to the c++ project (calling function) and the called function are in C. And i am getting error "undefined reference to "Hello(int,int)" " while linking. It is compiling correctly. It is linking to header file mention in the calling function. This header file has definition to the c - called function. Do you thinking having c files into C++ project will be a problem? Should I remove <stdio.h> in c files?
View 2 Replies View RelatedI'm new to C++ programing and also new to gcc compiler.
View 1 Replies View RelatedI have been trying to build a file called main.cpp through my make file which is in Linux.
There are functions like
Which are being called. I have included all the necessary headers and also have included the necessary lib.a files in the make file as below:
I am still getting the below error. I use make -j makefile.mak clean all command to make the build.
Do you have any ideas why does wxHyperlinkCtrl doesn't work on Linux?It has an error which says..."/usr/include/wx-2.8/wx/gdicmn.h:215: undefined reference to 'vtable for wxHyperlinkCtrl'"Do I have to include a certain library so that it will work in Linux? I try to compile it in windows and its succesful.'m having a problem on Linux guysinitialize the wxHyperlinkCtrl like this... wxHyperlinkCtrl* hyperlink1 = new wxHyperlinkCtrl();and included #include <wx/hyperlink.h> Is there something missing on it?... I already had tried supplying parameters on the constructor but same thing it gives me an error
View 1 Replies View RelatedI'm building my main program on SUSE using C, but the compiler returns the error below.
Code:
Here's my code to which the errors are pointing to:
Code:
I'm writing a binary search tree class to insert records and I'm stuck on the following error:
Code:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Here is the code for my class:
[Code]...
I really don't know how to approach this, I thought that everything was working fine but I have no idea what is wrong. Also, for clarification, main() is in a different .cpp file that #includes "tree.h"
I am trying to install NOX which is a openflow controller and it needs Xerces-C++ this. I installed it successfully on the Debian. The output of the xerces after running the "make install" command is as follows which shows that is successfully installed on the machine.
[Code]....
I am having trouble linking the pthread library.I have -lpthread -lm as options for the GNU GCC compiler.
Build Log
Compiling: main.c
Compiling: matrix.c
[code]...
read(224,114)inum(i,j),jnum(i,j),dx(i,j),dy(i,j),h(i,j),
1
Error: Unexpected array reference at (1)
I'm trying to create a simple times table on OpenOffice.org Spreadsheet
I'm trying to use the "$" in the top tab (input line) i.e.
Quote:
=A3*$B2$
Quote:
=A3*$B3$
[Code].....
To make the question clearer. When I used to use Microsoft Excel in Windows I would do just as I said in the above and I would be able to construct simple multiplication tables to more bigger/harder to memorize kind of type. And that would be by dragging the rectangle from it's bottom-right corner
Screenshot-5.jpg
Screenshot-4.jpg
So my question is what's the alternative OpenOffice.org Spreadsheet symbol for the "$" symbol used in the formula bar in Microsoft Excel?