#include" tid.h" #ifndef RENDER_ENGINE_HPP #define RENDER_ENGINE_HPP typedef struct tagBITMAP { ....} BITMAP; 类CRender {公开: CRender(); ~CRender(); void fskip(FILE * fp,int ); ..... 私人: ..... } ^^^^ 这里似乎缺少分号。 >> [...] > 什么都没有突出。 这是真的,它并不是真的坚持...... V - 请在通过电子邮件回复时删除资金''A' 我没有回复最热门的回复,请不要问 mlimber在留言中写道... > tienlx写道: >我正在学习C ++,我写了一个包含这些文件的小项目: ________________________ 在TID.h中: #ifndef TID_HPP_INCLUDED #define TID_HPP_INCLUDED typedef unsigned char byte; ..... 到OP: #ifdef EXIT_SUCCESS #undef EXIT_SUCCESS > #define EXIT_SUCCESS 0 #endif / / #ifdef EXI T_SUCCESS > .... ... #define LOG_FILE_NAME" log.txt" ; #include< graphics.h> #include< stdlib.h> #include< conio.h> #include< dos .h> #include< mem.h> #include< stdio.h> 也许张贴到''C''NG? < G> 或.... //> #include< stdlib.h> # include< cstdlib> //> #include< conio.h> //> #include< dos.h> //> #include< mem.h> #include< memory> //># include< stdio.h> #include< cstdio> > --- -------------------------------------------------- --- - Bob R POVrookie Hi,I''m learning C++, i wrote a small project that has these files:Log.hLog.cppRender.hRender.cppTid.hTid.cpp________________________In TID.h :#ifndef TID_HPP_INCLUDED#define TID_HPP_INCLUDEDtypedef unsigned char byte;......#define EXIT_SUCCESS 0.....#define BGI_DRIVER "SVGA64K"#define BGI_600_480 4#define SCREEN_WIDTH 600....#define LOG_FILE_NAME"log.txt"#include <graphics.h>#include <stdlib.h>#include <conio.h>#include <dos.h>#include <mem.h>#include <stdio.h>#include "Log.h"#include "MouseLib.h"#include "Render.h"#endif-----------------------------------TID.CPP#include "TiD.h"int main(void){...........return EXIT_SUCCESS;}___________________In LOG.h i have:#ifndef LOG_HPP_INCLUDED#define LOG_HPP_INCLUDEDvoid CLog_write(const char *s);#endif________________________________Log.CPP#include "TID.h"void CLog_write(const char* s){ ../*write file*/... }------------------------------------------------------Render.H#include "tid.h"#ifndef RENDER_ENGINE_HPP#define RENDER_ENGINE_HPPtypedef struct tagBITMAP{.....} BITMAP;class CRender{public:CRender();~CRender();void fskip(FILE * fp,int);......private:......}---------------------------------------------------------RENDER.CPP#include "TID.h"// Initialize graphic mode.CRender::CRender(){/* init BGI driver */}void CRender::PutImage (const char * filename,int x,int y,int ops)const{FILE *fp;....CLog_write("CRender::PutImage() : Invalid BMP file");.....}....--------------------------------------------------------When i compile in TC++ 3.0 i have error message:Error LOG.CPP 3: Too many types in declaration.I think the problem maybe about "include header" but i don''t know muchabout may files and many header, before i wrote simple programs with1 file (and one header).Thank for your help.TLE 解决方案 tienlx wrote:Hi,I''m learning C++, i wrote a small project that has these files:Log.hLog.cppRender.hRender.cppTid.hTid.cpp________________________In TID.h :#ifndef TID_HPP_INCLUDED#define TID_HPP_INCLUDEDtypedef unsigned char byte;.....#define EXIT_SUCCESS 0....#define BGI_DRIVER "SVGA64K"#define BGI_600_480 4#define SCREEN_WIDTH 600...#define LOG_FILE_NAME"log.txt"#include <graphics.h>#include <stdlib.h>#include <conio.h>#include <dos.h>#include <mem.h>#include <stdio.h>#include "Log.h"#include "MouseLib.h"#include "Render.h"#endif-----------------------------------TID.CPP#include "TiD.h"int main(void){ ...........return EXIT_SUCCESS;}___________________In LOG.h i have:#ifndef LOG_HPP_INCLUDED#define LOG_HPP_INCLUDEDvoid CLog_write(const char *s);#endif________________________________Log.CPP#include "TID.h"void CLog_write(const char* s){ ../*write file*/... }------------------------------------------------------Render.H#include "tid.h"#ifndef RENDER_ENGINE_HPP#define RENDER_ENGINE_HPPtypedef struct tagBITMAP{....} BITMAP;class CRender{public:CRender();~CRender();void fskip(FILE * fp,int);.....private:.....}---------------------------------------------------------RENDER.CPP#include "TID.h"// Initialize graphic mode.CRender::CRender(){ /* init BGI driver */}void CRender::PutImage (const char * filename,int x,int y,int ops)const{FILE *fp;...CLog_write("CRender::PutImage() : Invalid BMP file");....}...--------------------------------------------------------When i compile in TC++ 3.0 i have error message:Error LOG.CPP 3: Too many types in declaration.I think the problem maybe about "include header" but i don''t know muchabout may files and many header, before i wrote simple programs with1 file (and one header).Thank for your help.Nothing sticks out. See the guidelines for posting code: http://parashift.com/c++-faq-lite/ho...t.html#faq-5.8Post a minimal but *complete* example that we can copy and pasteunchanged into our editors to see the error you get. (Note that wedon''t have non-standard headers like graphics.h, dos.h, or conio.h.)Cheers! --M mlimber wrote:tienlx wrote:>Hi,I''m learning C++, i wrote a small project that has these files:[...]>------------------------------------------------------Render.H#include "tid.h"#ifndef RENDER_ENGINE_HPP#define RENDER_ENGINE_HPPtypedef struct tagBITMAP{....} BITMAP;class CRender{public:CRender();~CRender();void fskip(FILE * fp,int);.....private:.....}^^^^There seems to be a missing semicolon here.>>[...]>Nothing sticks out.That''s true, it doesn''t really "stick out"...V--Please remove capital ''A''s when replying by e-mailI do not respond to top-posted replies, please don''t askmlimber wrote in message...>tienlx wrote:>Hi,I''m learning C++, i wrote a small project that has these files:________________________In TID.h :#ifndef TID_HPP_INCLUDED#define TID_HPP_INCLUDEDtypedef unsigned char byte;.....To OP:#ifdef EXIT_SUCCESS#undef EXIT_SUCCESS>#define EXIT_SUCCESS 0#endif // #ifdef EXIT_SUCCESS>.......#define LOG_FILE_NAME "log.txt"#include <graphics.h>#include <stdlib.h>#include <conio.h>#include <dos.h>#include <mem.h>#include <stdio.h>Maybe post to an ''C'' NG? <G>Or....// >#include <stdlib.h>#include <cstdlib>// >#include <conio.h>// >#include <dos.h>// >#include <mem.h>#include <memory>// >#include <stdio.h>#include <cstdio>>----------------------------------------------------------Bob RPOVrookie 这篇关于声明中的类型太多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-28 00:21
查看更多