473,320 Members | 1,881 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,320 software developers and data experts.

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

Nov 11 '06 #1
7 3160
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DonMiche | last post by:
I'm having trouble producing an xml output from another xml file using xsl. The proper values are output to the browser as text with no formating or xml tags (<rowset> and <row>). Any ideas? ...
3
by: Peter Ammon | last post by:
Let's say I want to call a function but suppress what it writes to stdout. One way that works on my machine is this: #include <stdio.h> int main(void) { freopen("/dev/null", "w", stdout);...
7
by: John Swan | last post by:
I am starting to really hate managed C++. Ok. I am trying to add a newline character to a std::string and it won't do it. Whenever you put in << endl or + endl it wont compile because...
7
by: Brian Tkatch | last post by:
This is a shell question (bash), but i'm more familiar with this group, so i hope noone minds. I have a bash shell script which needs to query the database and return information into a...
14
by: fdu.xiaojf | last post by:
Hi, I'm writing a program which imports an external module writing in C and calls a function provided by the module to do my job. But the method produces a lot of output to the stdout, and this...
3
by: pnsreee | last post by:
Hi All, I am trying to print a log file created in the same script with the code bellow. but Im not getting output on screen. The output file is created using rediretion of output. ...
4
by: smashzone | last post by:
Hi all, Can anyone help me with a script to produce an output file of a "df -m" command with ";" seperators. I assume its very easy but I know nothing about Linux/Unix (I'm a newbie) That is: ...
2
by: jdbartlett | last post by:
I'm trying to capture output from a command line utility (XMLSec), but only get an empty result. If I call the script from the command line, I see XMLSec's output, but I can't seem to capture it!...
0
by: richard.slaymaker | last post by:
Hi All, I am outputting a table to a text file in Access 97 and the file I am get out contains a whole load of extra 'passing', see below: ...
2
by: pedalpete | last post by:
I've got a maintenance script that I run, and it takes quite a bit of time to run. On my dev machine, i can see the output as the script goes as I echo at certain points. On my production...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.