ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've used some routines from a already made program to make my own; but I get this error (both with gcc and g++) - the errors are in the "< HERE":
Quote:
In file included from SxP4Test.cpp:8:
stdafx.h:4:9: warning: #pragma once is obsolete
In file included from SxP4Test.cpp:11:
cTle.h:10:9: warning: #pragma once is obsolete
In file included from cTle.h:12,
from SxP4Test.cpp:11:
globals.h:4:9: warning: #pragma once is obsolete
In file included from SxP4Test.cpp:12:
cEci.h:6:9: warning: #pragma once is obsolete
In file included from cEci.h:8,
from SxP4Test.cpp:12:
cVector.h:6:9: warning: #pragma once is obsolete
cVector.h:27:3: warning: no newline at end of file
In file included from cEci.h:9,
from SxP4Test.cpp:12:
cJulian.h:6:9: warning: #pragma once is obsolete
In file included from cEci.h:10,
from SxP4Test.cpp:12:
Coord.h:6:9: warning: #pragma once is obsolete
In file included from SxP4Test.cpp:13:
cOrbit.h:11:9: warning: #pragma once is obsolete
In file included from cOrbit.h:15,
from SxP4Test.cpp:13:
cNoradBase.h:9:9: warning: #pragma once is obsolete
In file included from SxP4Test.cpp:14:
cSite.h:8:9: warning: #pragma once is obsolete
In file included from cSite.h:10,
from SxP4Test.cpp:14:
coord.h:6:9: warning: #pragma once is obsolete
In file included from cSite.h:10,
from SxP4Test.cpp:14:
coord.h:11: error: redefinition of `class cCoordGeo' < HERE
Coord.h:11: error: previous definition of `class cCoordGeo' < HERE
coord.h:26: error: redefinition of `class cCoordTopo' < HERE
Coord.h:26: error: previous definition of `class cCoordTopo' < HERE
In file included from SxP4Test.cpp:14:
cSite.h:38:3: warning: no newline at end of file
coord.h:16: warning: inline function `virtual cCoordGeo::~cCoordGeo()' used but
never defined
coord.h:31: warning: inline function `virtual cCoordTopo::~cCoordTopo()' used
but never defined
The class cCoordGeo and cCoordTopo at coord.h are like this:
Quote:
class cCoordGeo
{
public:
cCoordGeo();
cCoordGeo(double lat, double lon, double alt) :
m_Lat(lat), m_Lon(lon), m_Alt(alt) {}
virtual ~cCoordGeo() {};
double m_Lat;
double m_Lon;
double m_Alt;
};
and class cCoordTopo:
Quote:
class cCoordTopo
{
public:
cCoordTopo();
cCoordTopo(double az, double el, double rng, double rate) :
m_Az(az), m_El(el), m_Range(rng), m_RangeRate(rate) {}
virtual ~cCoordTopo() {};
This looks like code from a Visual C++ program, with the "stdafx.h." Pragma's are not usually going to work between different compilers, you can turn the warnings off though. Could you post the top of these header files? To me, it looks like your #define's are not setup properly, but I suspect there may be more problems.
As for this problem:
"coord.h:16: warning: inline function `virtual cCoordGeo::~cCoordGeo()' used but
never defined"
This is a warning, but I believe the line in the header should be as:
virtual cCoordGeo::~cCoordGeo()=0;
Granted, this is just a cursory inspection.
-- by the way, the question about using "gcc" or "g++," well ... Actually, they are the same. It depends on the extention of the file. If you do "g++ foo.c" it has the same effect as "gcc foo.c," that is running the C compiler. While running "gcc foo.cpp" will run the C++ compiler just as "g++ foo.cpp" does. Oh, but of course, the C compiler won't know what to make of all that "class" business. =)
//////////////////////////////////////////////////////////////////////
// cCoordGeo Class
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// cCoordTopo Class
//////////////////////////////////////////////////////////////////////
Mind that a #include <windows.h> instead of "stdafx.h"
might do the same job for you, without the tons of headers
included by stdafx.h, which a simple console program
very likely does not need (you may have to set Project->
Settings->C/C++/Precompiled headers to "automatically use
precompiled headers")
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.