473,324 Members | 2,548 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,324 software developers and data experts.

g++ compile warning: extra tokens at end of #include directive

I just started learning c++ and am at the point of using:

#include "myclass.cpp"

instead of having the class definition in the main file. But I am
getting this warning at compile time:

cat.cpp:4:19: warning: extra tokens at end of #include directive

The program compiles and runs fine, but the warning is puzzling and
concerns me. A google search returned lots of matches but no
solutions...

Any ideas? thanks

Jul 22 '05 #1
4 10629
japh wrote:
I just started learning c++ and am at the point of using:

#include "myclass.cpp"

instead of having the class definition in the main file. But I am
getting this warning at compile time:

cat.cpp:4:19: warning: extra tokens at end of #include directive

The program compiles and runs fine, but the warning is puzzling and
concerns me. A google search returned lots of matches but no
solutions...

Any ideas? thanks


You'd put the interface/declarations in say "myclass.h" and include
that. The definitions are in "myclass.cpp" and get added to your compile
( and link ) list for the project.

<aside>

ISO/IEC 14882:1998(E) © ISO/IEC
16.2 Source file inclusion
..
..
5 The mapping between the delimited sequence and the external source
file name is implementation defined. The implementation provides unique
mappings for sequences consisting of one or more nondigits (2.10)
followed by a period (.) and a single nondigit. The implementation may
ignore the distinctions of alphabetical case.

<end aside>

--

Cheers
--
Hewson::Mike
"This letter is longer than usual because I lack the time to make it
shorter" - Blaise Pascal
Jul 22 '05 #2
Yeah - I guess I wasn't precise in describing the problem. I do have a
header file, etc. The problem seems to be with including files.
#include <iostream> works fine.

#include "myheader.hpp"; yields a warning but still works.
I'm using g++ on FreeBSD

Thanks

Jul 22 '05 #3
DOH -- pretty simple error:

I was typing
#include "myclass.hpp";

instead of
#include "myclass.hpp"

It turns out the semi-colon was the problem.

Jul 22 '05 #4
japh wrote:
It turns out the semi-colon was the problem.


They're over-rated. Semi-colons are all just half-arsed. :-)

--

Cheers
--
Hewson::Mike
"This letter is longer than usual because I lack the time to make it
shorter" - Blaise Pascal
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
2
by: vinayby | last post by:
hi all, two doubts 1) in this code.. one might pass FUNC(x) definition externally.. #ifdef FUNC(x) double fnew(double x){ return FUNC(x); } #endif
1
by: electrixnow | last post by:
Help!, I need to compile this code with static libs so it run on another XP machine that does'nt have MS Studio installed. When I compile now I get an ERROR: 1>------ Rebuild All started:...
0
by: Jérôme Le Bougeant | last post by:
Hello (and sorry for my English), I downloaded the VideoCapture module on the http://videocapture.sourceforge.net/ site. I tested it with a webcam and that functions. Now I want to...
1
by: å¼ æ²ˆé¹ | last post by:
How to compile the HelloWorld of boost.asio? Maybe this is a stupid problem , but I really don't konw how to find the right way. My compile environment is WinXP, Msys , MinGw , G++ 3.4.2,...
18
by: mdh | last post by:
I am not sure if this is directly related to C or the compiler (Xcode) I am using...but I will ask and see. I have started creating unique C files ( .c and .h) so that I can reuse some of the...
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
2
myusernotyours
by: myusernotyours | last post by:
Hi All, Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.