|
I'm running an MFC apps in Visual 2012 for Genetic Algorithm Timetable.
c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
main.cpp
c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
GaScheduleDoc.cpp
c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
GaSchedule.cpp
c:\users\zahrina\documents\visual studio 2012\projects\gaschedule\gaschedule\gaschedule.h(6): fatal error C1189: #error : "include 'stdafx.h' before including this file for PCH"
CourseClass.cpp
Here is the coding for gaschedule.h
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h"
class CGaScheduleApp : public CWinApp
{
public:
CGaScheduleApp();
public:
virtual BOOL InitInstance();
public:
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP()
};
extern CGaScheduleApp theApp;
|
|
|
|
|
When using precompiled headers, you must include the file stdafx.h on top of all source files (*.cpp) before including other header files.
When not using precompiled headers, comment or remove the __AFXWIN_H__ condition lines in the gaschedule.h file.
Precompiled headers can be configured in the C/C++ section of your project settings.
|
|
|
|
|
thank you very much. it helps me.
|
|
|
|
|
Hi,
I need to convert the JSON file into XML file using C++ code.
Can anyone help me in this regard?
Thanks & Regards,
SAM
|
|
|
|
|
Help you with what? You need to explain what you have tried and what does not work, but don't expect someone else to write your program for you.
|
|
|
|
|
Hi Richard,
I need some link to start it from scratch..Atleast it will give me some basic idea about this. I am new to JSON..
Thanks,
SMA
|
|
|
|
|
I guess the difficult part is parsing the JSON format (writing XML , on comparison is easier) so any library/component able to parse JSON would do the trick.
Veni, vidi, vici.
|
|
|
|
|
libjson[^] looks interesting.
Veni, vidi, vici.
|
|
|
|
|
I am going through an older programming book which uses both C and Assembly. Most of these assembly routines are 16bit routines. How do I get Visual studio to link in my .obj files.
The first part of the book uses .asm files with a corrisponding .c file, where the c program uses the function in the .asm file.
As I scan through the book it looks like it uses inline assembly in the later parts of the book.
I have both MASM 6.11 and MASM32 and I have access to Visual Studio 6, 2005, and 2010.
These all are 32bit compilers, where the samples in the book all seem to be 16bit and I think they expect to run under DOS, not windows.
Is it possible to create these sample programs and test them?
I do have access to a machine that has Windows XP on it, if that would help?
Thanks!
|
|
|
|
|
(my 2c)
Get a new modern game programming book.
Unless you come around a REAL performance issue (measured and profiled), there is no need nowadays to use assembly code.
good modern C and C++ coding practice will be sufficient to do everything you need to do in a game.
As for the question, I don't have a clue; I've not touched assembly code in 20+ years of professional work.
I'd rather be phishing!
|
|
|
|
|
|
Actually I selected this book specifically because it was a mix of 16bit assembly and C. I have a project coming up that was written as a C and Assemby application. This gaming book looked like a fun way to pickup on the skills I need.
I have not done any C and Assembly mixed programming, before, so my biggest problem right now is to figure out how to successfully build a complete runable app.
I am not really planning to write a game, I just want to be able to get the samples to work as I read through the sections I need.
Thanks again!
|
|
|
|
|
Member 10875481 wrote: This gaming book looked like a fun way to pickup on the skills I need. On the contrary it is an extremely bad way. Learning how to write 16-bit applications is a total waste of time since Windows no longer supports them. Get hold of a modern book on C++ or C#, and a copy of the latest Visual Studio*, and spend your time learning the languages that will be of some real use.
* If you cannot afford to buy the pro version then you can get the Express Edition[^] which is free.
|
|
|
|
|
Hello All,
I wanted to implement a 'Wizard' based property sheet. Below is by plan.
1. In the first page, I will have three option (Option 1, 2 and 3)
2. If user selects 'Option 1' and clicks 'Next', I have to load Page 1. If user selects 'Option 2' and clicks 'Next' I have to load Page 2. If user selects 'Option 3' and clicks 'Next', I have to load page 3.
3. If user comes 'back' and changes the 'option' selection on run time, the page loading should be changed accordingly.
Is it possible to implement using MFC?
If yes, any help would be really appreciable.
Warm Regards,
Sankaran
|
|
|
|
|
P V Sankaran wrote: Is it possible to implement using MFC? Check out the AddPage() and RemovePage() members of CPropertySheet .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Which would be preferred code coverage tool for a bug fix project.
I have a base code and I had done some modification in some existing function as part of fix. I would like to ensure the code coverage of modified codes. Is there any tools in your knowledge that can help me to find how much of my modified code is covered.
aks
|
|
|
|
|
Hi all;
I am relearning C after about 20 years. (I had a done a course after which never wrote a line of C code to earn beer money). I would appreciate any sort of help with my current quandary - a function returning a pointer and returning structure variables.
#include <stdio.h>
typedef struct
{
float Centre[3];
float Radius;
} Sphere;
Sphere *MakeSphere(float *centre, float *radius);
void PrintSphereDetails(Sphere *s);
int main(int argc, const char * argv[])
{
float c1[3] = {10.0,20.0,30.0};
float r1 = 10.0;
Sphere *s1 = MakeSphere(&c1[0], &r1);
PrintSphereDetails(s1);
return 0;
}
Sphere *MakeSphere(float *centre, float *radius)
{
Sphere s;
s.Centre[0] = *centre++;
s.Centre[1] = *centre++;
s.Centre[2] = *centre;
s.Radius = *radius;
return &s;
}
void PrintSphereDetails(Sphere *s)
{
printf("------------------------------------------------\n");
printf("Centre: (%6.2f, %6.2f, %6.2f)\n", s->Centre[0], s->Centre[1], s->Centre[2] );
printf("Radius: %6.2f\n\n", s->Radius);
}
I am working in XCode and the code works, but I get a warning "Address of stack memory associated with local variable 's' returned." for the code line return &s in function MakeSphere. That is exactly what, I think, I need so what is XCode telling me?
Another problem, which XCode solved for me has to do with the way to get the values of the structure variables in function PrintSphereDetails. Initially I had them as s.Centre[0] but XCode flagged these and recommended doing s->Centre[0]. What is the difference?
Regards
Eric
The author's comes from a long line of evolved fish.
|
|
|
|
|
ericgahn wrote: Sphere s;
That line of code is creating the instance on the stack. The stack is only valid within the method and there is no assurance that it will continue to be valid.
You need to allocate it on the heap - look at the malloc method and associated other methods.
And remember to delete it when you are done with it.
|
|
|
|
|
Thank you for your reply.
Very helpful. I googled malloc() and used this site to further understand suggested soln.
Eric
|
|
|
|
|
As another option, you could change your function this way
void MakeSphere(float *centre, float *radius, Sphere *);
and initialize the struct allocated by the caller.
Veni, vidi, vici.
|
|
|
|
|
CPallini wrote: void MakeSphere(float *centre, float *radius, Sphere *);
So if I understand correctly a Sphere 'instance' would be created in Main() and then a pointer to this instance passed to the function?
|
|
|
|
|
Yes, you got it right.
Veni, vidi, vici.
|
|
|
|
|
When I attempt to set custom deleter of std::unique_ptr, I got this error:
.\src\iMoney.cpp(5): error C2664: 'std::unique_ptr<_Ty,_Dx>::unique_ptr(HINSTANCE__ *,void (__cdecl *const &)(HMODULE))' : cannot convert parameter 2 from 'void (__thiscall iMoney::* )(HMODULE)' to 'void (__cdecl *const &)(HMODULE)'
2> with
2> [
2> _Ty=HMODULE,
2> _Dx=void (__cdecl *)(HMODULE)
2> ]
2> Reason: cannot convert from 'void (__thiscall iMoney::* )(HMODULE)' to 'void (__cdecl *const )(HMODULE)'
2> There is no context in which this conversion is possible
2>
2>Build FAILED.
anybody can help me?
Here is my code snippet:
std::unique_ptr<HMODULE, decltype(&iMoney::freeLib)> m_ptrModule;
void iMoney::freeLib(HMODULE hModule){
m_pThisApp->FreeLibrary(hModule);
}
iMoney::iMoney(CReader_App* pApp)
: m_pThisApp(pApp)
, m_ptrModule(nullptr, &iMoney::freeLib)
{
}
|
|
|
|
|
I believe the delete method should take a iMoney not HMODULE (which is what the error says.) And since it takes an iMoney there is no reason for it to not be static.
|
|
|
|
|
Windows 7, visual Studio 2008, C++
WCHAR *op_type = NULL;
if( x )
op_type = &L"First";
else
op_type = &L"Second";
This solicits the error
Quote: error C2440: '=' : cannot convert from 'const wchar_t (*)[6]' to 'WCHAR *'
What is my syntax error?
I tried the declaration:
const wchar_t *op_type2 = NULL;
and received the error:
Quote: error C2440: '=' : cannot convert from 'const wchar_t (*)[6]' to 'const wchar_t *'
Which seems wrong to me. Why does the pointer care how long the string is? It is but the address of the first character.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com
modified 7-Jun-14 20:28pm.
|
|
|
|