By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,478 Members | 1,684 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,478 IT Pros & Developers. It's quick & easy.

how to include my code ?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.