LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-20-2006, 09:05 PM   #1
RHLinuxGUY
Member
 
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889
Blog Entries: 1

Rep: Reputation: 30
howto allow strings in header (.h) files?


I recently attempted to include prototypes of some of my files into my header file, but on "make", I recieved the following:

Code:
[georig1\ 18:52:50\ george\ ~/cfiles/George Lair/050606]$ make
g++ -c `sdl-config --cflags` main.cpp
In file included from main.cpp:9:
headerfiles.h:44: error: expected constructor, destructor, or type conversion before '*' token
headerfiles.h:44: error: expected `,' or `;' before '*' token
headerfiles.h:45: error: variable or field `WrightIn' declared void
headerfiles.h:45: error: `string' was not declared in this scope
make: *** [main.o] Error 1
[georig1\ 18:56:06\ george\ ~/cfiles/George Lair/050606]$
I googled string and makefile(s) and different phrasings of my problem, then just Makefiles and read a couple makefile tutorials, but so far I haven't come across anything showing that I can or can't have prototypes of string functions. So my question is, how do I have my string functions play nicely with my headerfile?

Here is the actual file:

Code:
#ifndef HEADERFILES_H
#define HEADERFILES_H

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <SDL/SDL.h>
#include "SDL_ttf.h"
#include <time.h>
#include <fstream>
#include <string>

void FightChk();
void display_bmp(char *file_name, int x2, int y2);
void display_font(int x2, int y2, int Psize, int R, int G, int B);
void move_xy(bool x, bool y);
string * ReadOut(void); // This operates in conjunction with ReadFilesLines()
void WrightIn(string STRING); // This operates alone.
void ReadFileLines(void); // This operates in conjuction with ReadOut()
	extern SDL_Surface *text_surface, *image, *screen;;
	extern bool done;
	extern SDL_Rect dest;

using namespace std;
#endif
 
Old 05-20-2006, 09:07 PM   #2
RHLinuxGUY
Member
 
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889

Original Poster
Blog Entries: 1

Rep: Reputation: 30
OOPS! Problem fixed, I should have put "using namespace std;" before all the prototype declarations!
 
  


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
group files by strings in dir Melsync Programming 7 12-17-2005 12:53 PM
Including header files and source files for classes Feenix Programming 8 09-28-2005 10:53 AM
c header files in linux in place of header files in windows? harun_acs Programming 1 03-17-2004 02:24 AM
Searching files for strings tmoorman Linux - Software 4 01-08-2004 01:46 PM
concatenating strings to open files veilig Programming 1 11-10-2003 05:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:42 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