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

Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

P: n/a
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.

But so far I've failed.

Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".

And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317): lambda~1.cpp:
undefined reference to `NR::gammln(double)'

Here is my program where I'm trying to calculate
the simple binomial coefficient

#include<iostream>
#include<cstdlib>
#include<iomanip>
#include "nr.h" // include Numerical Recipes
#include<math.h>
#include<cmath>

using namespace std;
using namespace NR;

double myBino(DP n, DP k);

int main()
{
return 0;
}

double myBino(DP n, DP k)
{
double value = 0;

value = exp(gammln(n + 1.) - gammln(k + 1.));

cout << myBino(10, 6);

return value;
}

Could someone help me? I don't know exactly where to
look to fix my problem to get the program to work.

Many thanks!

Nena

Nov 11 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Nena wrote:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.
I've meant to say "Version 4".

Nov 11 '06 #2

P: n/a
Nena wrote:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.

But so far I've failed.

Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".

And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317): lambda~1.cpp:
undefined reference to `NR::gammln(double)'

Here is my program where I'm trying to calculate
the simple binomial coefficient

#include<iostream>
#include<cstdlib>
#include<iomanip>
#include "nr.h" // include Numerical Recipes
#include<math.h>
#include<cmath>

using namespace std;
using namespace NR;

double myBino(DP n, DP k);

int main()
{
return 0;
}

double myBino(DP n, DP k)
{
double value = 0;

value = exp(gammln(n + 1.) - gammln(k + 1.));

cout << myBino(10, 6);

return value;
}

Could someone help me? I don't know exactly where to
look to fix my problem to get the program to work.
Your main exits immediately.
Nov 11 '06 #3

P: n/a
Nena wrote:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.

But so far I've failed.

Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".

And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317): lambda~1.cpp:
undefined reference to `NR::gammln(double)'

Here is my program where I'm trying to calculate
the simple binomial coefficient

#include<iostream>
#include<cstdlib>
#include<iomanip>
#include "nr.h" // include Numerical Recipes
#include<math.h>
#include<cmath>

using namespace std;
using namespace NR;

double myBino(DP n, DP k);

int main()
{
return 0;
}

double myBino(DP n, DP k)
{
double value = 0;

value = exp(gammln(n + 1.) - gammln(k + 1.));

cout << myBino(10, 6);

return value;
}

Could someone help me? I don't know exactly where to
look to fix my problem to get the program to work.

Many thanks!

Nena
This is a compiler issue. Your code needs to be linked with the library
code-- the linker is basically saying that it doesn't see a definition
of the function NR::gammln( double) anywhere.
Nov 11 '06 #4

P: n/a
Okay, thanks.
I'm C++ beginner. And how can I link my code with the library code?

Thanks!
Mark P wrote:
Nena wrote:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.

But so far I've failed.

Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".

And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317): lambda~1.cpp:
undefined reference to `NR::gammln(double)'

Here is my program where I'm trying to calculate
the simple binomial coefficient

#include<iostream>
#include<cstdlib>
#include<iomanip>
#include "nr.h" // include Numerical Recipes
#include<math.h>
#include<cmath>

using namespace std;
using namespace NR;

double myBino(DP n, DP k);

int main()
{
return 0;
}

double myBino(DP n, DP k)
{
double value = 0;

value = exp(gammln(n + 1.) - gammln(k + 1.));

cout << myBino(10, 6);

return value;
}

Could someone help me? I don't know exactly where to
look to fix my problem to get the program to work.

Many thanks!

Nena

This is a compiler issue. Your code needs to be linked with the library
code-- the linker is basically saying that it doesn't see a definition
of the function NR::gammln( double) anywhere.
Nov 11 '06 #5

P: n/a
I've tried the following to link my code with the
library code under the Dev-C++ editor:

Options -Compiler options -Directories

Then I've added the path of my Numerical Recipes folder
into "C++ include files" and "Libraries directory".
Result: DOESN'T HELP!
I still obtain the same messages.

Aarrhhhhhhhh! Help!
Nena wrote:
Okay, thanks.
I'm C++ beginner. And how can I link my code with the library code?

Thanks!
Mark P wrote:
Nena wrote:
Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.
>
But so far I've failed.
>
Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".
>
And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317): lambda~1.cpp:
undefined reference to `NR::gammln(double)'
>
Here is my program where I'm trying to calculate
the simple binomial coefficient
>
#include<iostream>
#include<cstdlib>
#include<iomanip>
#include "nr.h" // include Numerical Recipes
#include<math.h>
#include<cmath>
>
using namespace std;
using namespace NR;
>
double myBino(DP n, DP k);
>
int main()
{
return 0;
}
>
double myBino(DP n, DP k)
{
double value = 0;
>
value = exp(gammln(n + 1.) - gammln(k + 1.));
>
cout << myBino(10, 6);
>
return value;
}
>
Could someone help me? I don't know exactly where to
look to fix my problem to get the program to work.
>
Many thanks!
>
Nena
>
This is a compiler issue. Your code needs to be linked with the library
code-- the linker is basically saying that it doesn't see a definition
of the function NR::gammln( double) anywhere.
Nov 11 '06 #6

P: n/a
Nena wrote:
Mark P wrote:
>Nena wrote:
>>Hi there,
I'm trying to include the Numerical Recipes for C++
for the Dev-C++ Editor Version.

But so far I've failed.

Therefore I've copied all head-files (for example nr.h)
into the folder where my program is. When compiling my
program two windows are poping up.
The first one is saying "Total errors 0" and "Size of
output file: 0".

And the second window behind the first one is a
"compiler and linker output" with the following two
lines
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x2fc ):lambda~1.cpp:
undefined reference to `NR::gammln(double)'
C:\DOKUME~1\LOKALE~1\Temp\ccyQaaaa.o(.text+0x317 ):lambda~1.cpp:
undefined reference to `NR::gammln(double)'

This is a compiler issue. Your code needs to be linked with the library
code-- the linker is basically saying that it doesn't see a definition
of the function NR::gammln( double) anywhere.
Okay, thanks.
I'm C++ beginner. And how can I link my code with the library code?

Thanks!
First, don't top-post-- reply below the message to which you're responding.

To your question, I don't know. You'll need to look at the
documentation for your compiler and perhaps also any info included with
the NR text. Generally you need to tell the compiler the name and
location of the library, but the details of this will depend on your
specific setup.

Normally I would say to find a discussion forum for your compiler, and
you might still try this, but Dev-C++ is sort of defunct at this point
and I don't know how much support you'll find. I'd suggest trying its
free successor, CodeBlocks, as you might find a more active community to
help you.
Nov 11 '06 #7

P: n/a
Nena wrote:
I've tried the following to link my code with the
library code under the Dev-C++ editor:

Options -Compiler options -Directories

Then I've added the path of my Numerical Recipes folder
into "C++ include files" and "Libraries directory".
Result: DOESN'T HELP!
I still obtain the same messages.

Aarrhhhhhhhh! Help!
That's only half of what you need. That's the location to look for the
library, but you haven't provided the name of the library. Take a look at:

http://www.uniqueness-template.com/devcpp/

Near the bottom, there's an item called "Using library files". Follow
the general instructions there and add the appropriate -l[libname] flags
to the linker.
Nov 11 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.