Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 11th, 2006, 03:15 AM
Nena
Guest
 
Posts: n/a
Default Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

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

  #2  
Old November 11th, 2006, 03:15 AM
Nena
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

Nena wrote:
Quote:
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".

  #3  
Old November 11th, 2006, 05:25 AM
red floyd
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

Nena wrote:
Quote:
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.
  #4  
Old November 11th, 2006, 05:35 AM
Mark P
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

Nena wrote:
Quote:
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.
  #5  
Old November 11th, 2006, 10:55 AM
Nena
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

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

Thanks!


Mark P wrote:
Quote:
Nena wrote:
Quote:
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.
  #6  
Old November 11th, 2006, 11:25 AM
Nena
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

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:
Quote:
Okay, thanks.
I'm C++ beginner. And how can I link my code with the library code?
>
Thanks!
>
>
Mark P wrote:
Quote:
Nena wrote:
Quote:
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.
  #7  
Old November 11th, 2006, 06:05 PM
Mark P
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

Nena wrote:
Quote:
Mark P wrote:
Quote:
>Nena wrote:
Quote:
>>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.
>
Quote:
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.
  #8  
Old November 11th, 2006, 06:15 PM
Mark P
Guest
 
Posts: n/a
Default Re: Rubbish Output Dev-C Compiler / Program for Binomial Coefficient

Nena wrote:
Quote:
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.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles