Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > Platform/API C++

Reply
 
LinkBack Thread Tools Display Modes
Old 06-28-2005, 09:09 AM   #1 (permalink)
Nielszz
Nielszzz
 
Nielszz's Avatar
 
Join Date: Apr 2005
Location: Holland!!
Posts: 13
Nielszz is on a distinguished road
warning cannot create pre compiled header: initialized data in header

warning cannot create pre compiled header: initialized data in header

i get this header when i comple my cpp in borland
this are my codes

my main.cpp
Code:
#include <iostream.h>
#include <conio.h>
#include "functies.h"

void main()
{
	cout << "Druk op <Enter> om het spel te starten." << endl;

   speelveld();

	getch();
}
my header (functies.h)
Code:
int i = 0;

void speelveld(void)
{
	gotoxy(1,1);

 		for(i = 1 ; i <= 80 ; i++ )
 		{
 			cout << "*";
 		}

 		for(i = 1 ; i <= 24 ; i++ )
 		{
			gotoxy(1,i);
			cout << "*";
		}

	gotoxy(1,24);

 		for(i = 1 ; i <= 80 ; i++ )
 		{
 			cout << "*";
 		}

   gotoxy(24, 1);

   	for (i = 1 ; i <= 24 ; i++)
      {
      gotoxy(80,i);
      cout << "*";
      }
}
i am very stuck please help
thx already

Last edited by redhead; 06-28-2005 at 01:42 PM. Reason: Added [code][/code] tags
Nielszz is offline   Reply With Quote
Old 06-28-2005, 02:00 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
First off, this code looks to be C++, yet the include statements are using C-style. In order to accomodate C++ -style, you would discard the .h on teh included standard headers, and in some cases add a c to the beginning like:
Code:
// C-style 
#include <string.h>
// C++ -style
#include <string>
// C-style
#include <time.h>
// C++ -style
#include <ctime>
Also you need to tell what namespace you're using like:
Code:
using namespace std;
Second, have you tried adding:
Code:
#include <iostream.h>
#include <conio.h>
to your functies.h
Third, given the fact, that you're using a header file to declare the actual function code, might confuse your compiler, so you might want to try adding a ; at the end of your functies.h like:
Code:
....
      gotoxy(80,i);
      cout << "*";
      }
};
Since I've never personaly used Borland, I can't say why it is acting this way.. Some compilers complain when your dont create a project to hold the files, when your using seperate files.. Perhaps that is the problem here too..
Else I can't say why it would come with an error like that.. Given that there isn't even a reference to a line in your code.

Last(ly). Since you're using conio.h with the reference to gotoxy(), your code isn't ISO/ANSI, so you might wound up with us giving advises that isn't conforming to your specific compiler
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 06-28-2005, 02:06 PM   #3 (permalink)
Nielszz
Nielszzz
 
Nielszz's Avatar
 
Join Date: Apr 2005
Location: Holland!!
Posts: 13
Nielszz is on a distinguished road
thx for your reply but i have put all my code and functions in one cpp file

the reason why i use header files because it would be more neat( or clean i dont know how to say)

and i dont realy know what namespaces are...

but thx for your explaining it explaned a lot

and i think that borland wants the files in a project but i dont know for sure and i dont have time to figure that out i am on a dead line for school
Nielszz is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 01:17 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting