LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-28-2005, 12:34 PM   #1
tommyj27
Member
 
Registered: May 2003
Distribution: Ubuntu, Slackware
Posts: 43

Rep: Reputation: 15
problem compiling c++ header in slack 10.1


greetings,

i hope someone here has a clue, because i've been scratching my head over this one.

i'm working on a c++ app and i've got my function prototypes defined in a header file (prototypes.h). when i try to compile the code g++ chokes on any prototype that uses ofstream as a return type or input type. when i try to compile i get the following error output:

Code:
In file included from fileio.cpp:11:
prototypes.h:15: error: syntax error before `*' token
prototypes.h:16: error: `ofstream' was not declared in this scope
prototypes.h:16: error: parse error before `,' token
the lines that it refers to are:

Code:
ofstream* openAppendFile();      // open file for appending
void  appendToFile(ofstream*, char*);  // append string to file
afaik, this is valid code. and what makes it all the more frustrating is that while the code won't compile on any of my systems (all slackware 10.1), it compiles w/o even a smart remark on my buddy's slackware 8.1 machine. unfortunately i don't have any other distributions/versions on which to try the build, so i can't tell whether the problem is with 10.1 or not.

i am still in the process of learning c++ so forgive me if i'm not seeing the totally obvious.
 
Old 10-28-2005, 04:26 PM   #2
tommyj27
Member
 
Registered: May 2003
Distribution: Ubuntu, Slackware
Posts: 43

Original Poster
Rep: Reputation: 15
update:

i upgraded a system to slack 10.2 and the problem remains.

*bump*
 
Old 10-28-2005, 05:10 PM   #3
tommyj27
Member
 
Registered: May 2003
Distribution: Ubuntu, Slackware
Posts: 43

Original Poster
Rep: Reputation: 15
solved.

i didn't realize i needed a
Code:
using namespace std;
in the header file too.
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error while parsing chunk header. Mplayer error only under Slack vdemuth Linux - Software 5 02-19-2007 11:09 AM
Compiling C++ Header Files ?? JinBaba Programming 3 07-20-2005 03:23 AM
Compiling a header file with gcc Squall Linux - Software 2 04-07-2004 05:16 AM
compiling slack 9.x abs Slackware 6 01-31-2004 03:18 AM
compiling header files with anjuta santiagom5 Linux - Software 7 01-30-2004 12:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration