473,397 Members | 2,099 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,397 software developers and data experts.

how to include my code ?

i have made an glut-program to represent some data.
I would like to use the glut-program in an other program
How do i include the glut-program ?

int main(int argc, char *argv[]) // the main of my glut program
{
glutInit(&argc, argv);
// etc etc
return EXIT_SUCCESS;
}

i would like to use this program in an other source code
like this:
#include "glutProgram.h"

i have made a few attempts but i get alot of these:
[Linker error] undifined reference to 'gluCylinder@36'
etc, etc.

how can i make this work ?

Jul 23 '05 #1
3 1209
"mrDumbass" writes:
i have made an glut-program to represent some data.
I would like to use the glut-program in an other program
How do i include the glut-program ?

int main(int argc, char *argv[]) // the main of my glut program
{
glutInit(&argc, argv);
// etc etc
return EXIT_SUCCESS;
}

i would like to use this program in an other source code
like this:
#include "glutProgram.h"

i have made a few attempts but i get alot of these:
[Linker error] undifined reference to 'gluCylinder@36'
etc, etc.

how can i make this work ?


Can you see glutprogram.h in the directory you are using by use of the file
manager? My guess is that you can't. You can *execute* other program from
within a C++ program by using the system command. Which is not he same as
include (your word). I can't think of any case where you want to include
one program within another. A C++ program has only one main function so
that's a real hurdle right there.
Jul 23 '05 #2
mrDumbass wrote:
i have made an glut-program to represent some data.
What's a "glut-program"?
I would like to use the glut-program in an other program
How do i include the glut-program ?

int main(int argc, char *argv[]) // the main of my glut program
{
glutInit(&argc, argv);
// etc etc
return EXIT_SUCCESS;
}

i would like to use this program in an other source code
like this:
#include "glutProgram.h"
What's in that file, 'glutProgram.h'?
i have made a few attempts but i get alot of these:
[Linker error] undifined reference to 'gluCylinder@36'
etc, etc.

how can i make this work ?


This is not really a C++ language question, but the procedure is
reasonably common, so it might as well be... What you do usually is
create an object file from your source file where the functions live
by compiling it, and then _link_ it in with the other object files to
create the final executable program. That's as much as anybody can
probably tell you while staying off compiler-specific issues.

You need to get a book on using the means available to you in your
compiler or build system to create a program from more than one source
file. And since those things are definitely not defined by C++, you
should consider asking in a newsgroup that deals with your compiler.

V
Jul 23 '05 #3
Ah, your reactions let me relize that i want something i dont need, or
anyone else for that matter. pff i need a breake.

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
6
by: Simon Elliott | last post by:
(Note: this is a real C++ question and not an MS Windows question. The window handle I introduce is just an example of OS specific data, which I've used to illustrate my question.) I have some...
28
by: Ramesh | last post by:
Hi, I am currently maintaining a legacy code with a very very large code base. I am facing problems with C/C++ files having a lot of un-necessary #includes. On an average every C/C++ file has...
6
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
11
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
3
by: sunnylele | last post by:
Hi, all, I have a question on the use of #include: #include <unistd.h> #include <asm/unistd.h> #include "nn.h" What are the differences between the above three usages? It seems the third...
7
by: Bill Pursell | last post by:
I read recently (can't remember if it was on this group or elsewhere) that it is a bad idea to write a header file this way: #ifndef FOO_HDR #define FOO_HDR 1 #include <stdio.h> int...
2
by: key9 | last post by:
Hi all look at the organize tree main.c ------ #include lib_adapter.c main() { foo();
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.