V
Vicent Giner-Bosch
Hello.
I am used to "old" programming languages, like FORTRAN, BASIC ("Goto
10"), and so on --or maybe I should say "old" programming techniques,
where the whole program was in one file, and so on.
And now I am working with Visual C++ 6.0, on Windows XP. I understand
that #include sentences are used for "including" other program files
into the current "program" (project), so that the functions they
contain can be also "called" by my main program or routine. OK.
But, what I don't understand is the following:
(1) Which is the difference between a ".cpp" file and a ".h" file? Why
is it more frequent including ".h" files than ".cpp" ones?
(2) Which is the difference between #include <something>, #include
<something.h>, #include "something.h"? Are they interchangeable?
(3) I have ".cpp" example files that contain #include
<something.h> and I have to change it by #include "something.h"
in order to make it work -- I mean, if I try to compile the ".cpp"
file, I get an error when I have #include <something.h> ("No such
file or directory"), and I don't get any error or warning when I
change it by #include "something.h". It always happens the same,
with every project (even with examples, as I said), no matter which
files I am including. Is that an expected behavior?? Is it maybe
something related with MS Visual C++ options or settings??
(4) The biggest problem/question here:
I am working with the GNU Scientific Library (GSL), specifically with
GSL 1.11 "prepared" for Windows by David Geldreich (http://
david.geldreich.free.fr/dev.html). I downloaded and unzipped the
"binaries for Windows" package. I copied the "gsl" folder (the one
which is in the "include" folder, and that contains lots of ".h"
files) in the same directory where my main ".cpp" file is.
In my main ".cpp" file I have #include "gsl/gsl_cdf.h", because
#include <gsl/gsl_cdf.h> didn't work for me, as I said at (3).
I compile the main file (Ctrl+F7), and everything is OK.
Then, I try to build the main file (F7), called "OPCA_01.cpp", and I
get this error:
""" Linking...
OPCA_01.obj : error LNK2001: unresolved external symbol
_gsl_cdf_ugaussian_P
Debug/OPCA_01.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. """
In my program, I call a function called "gsl_cdf_ugaussian_P", which
is defined in the file "gsl_cdf.h", which is in the "gsl" folder.
I don't understand why I get that estrange error. I didn't typewrite
"_gsl_cdf_ugaussian_P" in any moment.
So, can you help me to understand what am I doing wrong???
Thank you in advance for your help.
I am used to "old" programming languages, like FORTRAN, BASIC ("Goto
10"), and so on --or maybe I should say "old" programming techniques,
where the whole program was in one file, and so on.
And now I am working with Visual C++ 6.0, on Windows XP. I understand
that #include sentences are used for "including" other program files
into the current "program" (project), so that the functions they
contain can be also "called" by my main program or routine. OK.
But, what I don't understand is the following:
(1) Which is the difference between a ".cpp" file and a ".h" file? Why
is it more frequent including ".h" files than ".cpp" ones?
(2) Which is the difference between #include <something>, #include
<something.h>, #include "something.h"? Are they interchangeable?
(3) I have ".cpp" example files that contain #include
<something.h> and I have to change it by #include "something.h"
in order to make it work -- I mean, if I try to compile the ".cpp"
file, I get an error when I have #include <something.h> ("No such
file or directory"), and I don't get any error or warning when I
change it by #include "something.h". It always happens the same,
with every project (even with examples, as I said), no matter which
files I am including. Is that an expected behavior?? Is it maybe
something related with MS Visual C++ options or settings??
(4) The biggest problem/question here:
I am working with the GNU Scientific Library (GSL), specifically with
GSL 1.11 "prepared" for Windows by David Geldreich (http://
david.geldreich.free.fr/dev.html). I downloaded and unzipped the
"binaries for Windows" package. I copied the "gsl" folder (the one
which is in the "include" folder, and that contains lots of ".h"
files) in the same directory where my main ".cpp" file is.
In my main ".cpp" file I have #include "gsl/gsl_cdf.h", because
#include <gsl/gsl_cdf.h> didn't work for me, as I said at (3).
I compile the main file (Ctrl+F7), and everything is OK.
Then, I try to build the main file (F7), called "OPCA_01.cpp", and I
get this error:
""" Linking...
OPCA_01.obj : error LNK2001: unresolved external symbol
_gsl_cdf_ugaussian_P
Debug/OPCA_01.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe. """
In my program, I call a function called "gsl_cdf_ugaussian_P", which
is defined in the file "gsl_cdf.h", which is in the "gsl" folder.
I don't understand why I get that estrange error. I didn't typewrite
"_gsl_cdf_ugaussian_P" in any moment.
So, can you help me to understand what am I doing wrong???
Thank you in advance for your help.