Click here to Skip to main content
15,912,069 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalselect() Pin
Alexander M.,25-Oct-03 13:37
Alexander M.,25-Oct-03 13:37 
GeneralRe: select() Pin
Johnny ²25-Oct-03 21:43
Johnny ²25-Oct-03 21:43 
Generalruntime C++ linking Pin
Alexander M.,25-Oct-03 12:10
Alexander M.,25-Oct-03 12:10 
GeneralRe: runtime C++ linking Pin
Jörgen Sigvardsson26-Oct-03 5:41
Jörgen Sigvardsson26-Oct-03 5:41 
QuestionCurrent username? Pin
M.u.m.b.a25-Oct-03 8:32
M.u.m.b.a25-Oct-03 8:32 
AnswerRe: Current username? Pin
Alexander M.,25-Oct-03 11:44
Alexander M.,25-Oct-03 11:44 
AnswerRe: Current username? Pin
Blake Coverett25-Oct-03 19:19
Blake Coverett25-Oct-03 19:19 
Generalthis is so weird - try it and see Pin
Oinka25-Oct-03 8:06
Oinka25-Oct-03 8:06 
Using VisualC++ 6.0 SP5 I create a new MFCAppwizard(exe) project named "my". I choose SDI with doc/view architecture support then click finish to leave all other options at their defaults. Since the project is named "my" the classes created are "CMyApp", "CMyDoc", "CMyView", "CMainFrame" and "CAboutDlg". If I build it now it will run fine so far. Then if I include the header for the CMyView class in the cpp for the CMainFrame class like so:

<br />
// MainFrm.cpp : implementation of the CMainFrame class<br />
//<br />
<br />
#include "stdafx.h"<br />
#include "my.h"<br />
<br />
#include "MainFrm.h"<br />
<br />
#include "myview.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
...<br />
...<br />
...<br />


it does not compile. The 3 errors it gives are really weird:


myprojects\my\myview.h(21) : error C2143: syntax error : missing ';' before '*'
myprojects\my\myview.h(21) : error C2501: 'CMyDoc' : missing storage-class or type specifiers
myprojects\my\myview.h(21) : error C2501: 'GetDocument' : missing storage-class or type specifiers


weird, eh? I noticed that if you move the #include "myview.h" line to the top of the file (i.e. before the other three #include statements) it will compile but if you make reference to anything that was declared in myview.h it will give an error saying "undeclared identifier".

For example if I wanted to create a pointer to a CMyView class within the constructor of the CMainFrame class like so:

<br />
// CMainFrame construction/destruction<br />
CMainFrame::CMainFrame()<br />
{<br />
	CMyView* p;<br />
}<br />


it gives the following error messages:


MyProjects\my\MainFrm.cpp(45) : error C2065: 'CMyView' : undeclared identifier
MyProjects\my\MainFrm.cpp(45) : error C2065: 'p' : undeclared identifier
MyProjects\my\MainFrm.cpp(45) : warning C4552: '*' : operator has no effect; expected operator with side-effect


(remember that is with the #include "myview.h" moved to the very top of the mainfrm.cpp file

anybody know why it doesn't like what I'm trying to do? I'm a bit new at this and I searched the forum for someone asking the same question but didn't find anything relevant.

thanks!

-Oinka
GeneralRe: this is so weird - try it and see Pin
Michael P Butler25-Oct-03 9:05
Michael P Butler25-Oct-03 9:05 
GeneralHey thanks that worked - but I'm still confused Pin
Oinka25-Oct-03 9:14
Oinka25-Oct-03 9:14 
GeneralRe: Hey thanks that worked - but I'm still confused Pin
Michael P Butler25-Oct-03 9:33
Michael P Butler25-Oct-03 9:33 
GeneralC++ Data Structures (3rd), Chapter 3, Exercise 8 a+b, pg 171 Pin
aLiSoN374225-Oct-03 7:58
sussaLiSoN374225-Oct-03 7:58 
GeneralRe: C++ Data Structures (3rd), Chapter 3, Exercise 8 a+b, pg 171 Pin
Oinka25-Oct-03 8:56
Oinka25-Oct-03 8:56 
GeneralC++ Data Structures (3rd), Chapter 4, Exercise 14, p 267 Pin
aLiSoN374225-Oct-03 7:56
sussaLiSoN374225-Oct-03 7:56 
GeneralRe: C++ Data Structures (3rd), Chapter 4, Exercise 14, p 267 Pin
joshfl25-Oct-03 8:45
joshfl25-Oct-03 8:45 
GeneralRe: C++ Data Structures (3rd), Chapter 4, Exercise 14, p 267 Pin
Oinka25-Oct-03 10:21
Oinka25-Oct-03 10:21 
GeneralRe: C++ Data Structures (3rd), Chapter 4, Exercise 14, p 267 Pin
Terry O'Nolley25-Oct-03 14:34
Terry O'Nolley25-Oct-03 14:34 
GeneralRe: C++ Data Structures (3rd), Chapter 4, Exercise 14, p 267 Pin
Jörgen Sigvardsson26-Oct-03 5:45
Jörgen Sigvardsson26-Oct-03 5:45 
GeneralPlotting Graphs Pin
emrosa25-Oct-03 7:30
emrosa25-Oct-03 7:30 
GeneralRe: Plotting Graphs Pin
Oinka25-Oct-03 10:11
Oinka25-Oct-03 10:11 
GeneralNeed help developing algorithm Pin
Steven M Hunt25-Oct-03 5:54
Steven M Hunt25-Oct-03 5:54 
GeneralRe: Need help developing algorithm Pin
CillyMe25-Oct-03 8:05
CillyMe25-Oct-03 8:05 
GeneralRe: Need help developing algorithm Pin
Steven M Hunt25-Oct-03 8:24
Steven M Hunt25-Oct-03 8:24 
GeneralRe: Need help developing algorithm Pin
Oinka25-Oct-03 8:49
Oinka25-Oct-03 8:49 
GeneralRe: Need help developing algorithm Pin
Ravi Bhavnani25-Oct-03 9:02
professionalRavi Bhavnani25-Oct-03 9:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.