question about the AppWizard

Dear everyone
I can create a occfram window by ocaf Appwizard in MS
vc++ 6.0.I want the window to work as that when I click a button ,a line or circle will be painted.So I used the code of the sample"AISBasic".Here is the code:
gp_Lin L(gp_Pnt(0.,0.,0.),gp_Dir(1.,0.,0.));
Handle(Geom_Line) aLine = new Geom_Line(L);
Handle(AIS_Line) anAISLine = new AIS_Line(aLine);
myAISContext->Display(anAISLine);
But unfortunatly many errors come:
E:\yier\sixth\MainFrm.cpp(91) : error C2065: 'gp_Lin' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(91) : error C2146: syntax error : missing ';' before identifier 'L'
E:\yier\sixth\MainFrm.cpp(91) : error C2065: 'L' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(91) : error C2065: 'gp_Pnt' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(91) : error C2065: 'gp_Dir' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(92) : error C2065: 'Handle_Geom_Line' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(92) : error C2146: syntax error : missing ';' before identifier 'aLine'
E:\yier\sixth\MainFrm.cpp(92) : error C2065: 'aLine' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(92) : error C2061: syntax error : identifier 'Geom_Line'
E:\yier\sixth\MainFrm.cpp(93) : error C2065: 'Handle_AIS_Line' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(93) : error C2146: syntax error : missing ';' before identifier 'anAISLine'
E:\yier\sixth\MainFrm.cpp(93) : error C2065: 'anAISLine' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(93) : error C2061: syntax error : identifier 'AIS_Line'
E:\yier\sixth\MainFrm.cpp(94) : error C2065: 'myAISContext' : undeclared identifier
E:\yier\sixth\MainFrm.cpp(94) : error C2227: left of '->Display' must point to class/struct/union
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
E:\yier\sixth\MainFrm.cpp(95) : error C2143: syntax error : missing ';' before '}'
Could Someone do me a favor,and tell me how to use the Appwizard?Right now I am so confused, I will so appreciate your help...

Sharjith Naramparambath's picture

The solution is simple; for every class name you see in the error message, simply include the header for that. eg.
E:\yier\sixth\MainFrm.cpp(91) : error C2065: 'gp_Pnt' : undeclared identifier
for this write #include in your .cpp file

You probably copied only the code from the sample. Also include the headers and it will compile!

Also from the messages I see above, it seems that you have not added the code in a suitable place. The Application Document source file is the suitable place to add the geometry creation to keep the project organized and consistent.

You also require some knowledge of the MFC Document/View architecture that the wizard generated code uses.

Hope my suggestion helps you!

Regards
N. Sharjith

justherowan's picture

Dear Nair Sharjith
Thank you very much.
According the sample ,I added the include file one by one and then the errors disappeared.
Thanks a lot.

stifan's picture

dear friends;
i would like to create a new workspace in Microsoft Studio 2005 (application console win32), and i like to compile my code with opencascade librairy 6.2:
for exemple:
#include
error: when i compile my code: not open math_matrix.h: not such file or directory
please help me.

Sharjith Naramparambath's picture

Hi,
Go to the project options and set (add) the directories for include, lib and bin respectively to the corresponding Opencascade directories.

Regards
N, Sharjith

stifan's picture

hi,
firestly think you for your reply, secondly, i want to project options and i set (add) the directories for include (D:ros/inc and D: ros/win32;)
i compile my code: error: "Wrong compiler options has been detected. Add /DWNT option for proper compilation!!!!!"

please help me; i'm sorry for my english
think you

Sharjith Naramparambath's picture

Hi,
If the path you have written is exactly the same shown above, the mistake is the missing slash after D:
Have you installed OpenCASCADE into D: directly?

Also add the /DWNT as the compiler suggests. It is a macro required by OpenCASCADE. Either set it at the compiler options by passing /DWNT or by adding..

#ifndef WNT
#define WNT
#endif

in your stdafx.h file

Regards
N. Sharjith

stifan's picture

think you for reply:

after add the : #ifndef WNT
#define WNT
#endif

to stdafx.h , i compile my code many error:(please help me)

error/------ Build started: Project: testbrep, Configuration: Debug Win32 ------
Compiling...
stdafx.cpp
Compiling...
testbrep.cpp
Linking...
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
Creating library D:\samples\standard\mfc\02_TopologySamples\testbrep\Debug\testbrep.lib and object D:\samples\standard\mfc\02_TopologySamples\testbrep\Debug\testbrep.exp
testbrep.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall Standard_Storable::Delete(void)" (?Delete@Standard_Storable@@UAEXXZ) referenced in function "public: virtual __thiscall Standard_Storable::~Standard_Storable(void)" (??1Standard_Storable@@UAE@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Standard_Storable::HashCode(int)const " (?HashCode@Standard_Storable@@UBEHH@Z)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Standard_Storable::ShallowDump(class std::basic_ostream > &)const " (?ShallowDump@Standard_Storable@@UBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)
testbrep.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Standard::Free(void * &)" (?Free@Standard@@SAXAAPAX@Z) referenced in function "public: static void __cdecl Standard_Storable::operator delete(void *)" (??3Standard_Storable@@SAXPAX@Z)
testbrep.obj : error LNK2019: unresolved external symbol "private: void __thiscall Handle_Standard_Transient::EndScope(void)" (?EndScope@Handle_Standard_Transient@@AAEXXZ) referenced in function "public: __thiscall Handle_Standard_Transient::~Handle_Standard_Transient(void)" (??1Handle_Standard_Transient@@QAE@XZ)
testbrep.obj : error LNK2019: unresolved external symbol "public: void __thiscall Standard_Type::Print(class std::basic_ostream > &)const " (?Print@Standard_Type@@QBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) referenced in function "public: void __thiscall Standard_Type::operator<<(class std::basic_ostream > &)const " (??6Standard_Type@@QBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)
testbrep.obj : error LNK2019: unresolved external symbol "public: __thiscall Standard_Failure::Standard_Failure(void)" (??0Standard_Failure@@QAE@XZ) referenced in function "public: __thiscall Standard_DomainError::Standard_DomainError(void)" (??0Standard_DomainError@@QAE@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Standard_Transient::Delete(void)const " (?Delete@Standard_Transient@@UBEXXZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Standard_Transient::HashCode(int)const " (?HashCode@Standard_Transient@@UBEHH@Z)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Standard_Transient::ShallowDump(class std::basic_ostream > &)const " (?ShallowDump@Standard_Transient@@UBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Type const & __thiscall Standard_DomainError::DynamicType(void)const " (?DynamicType@Standard_DomainError@@UBEABVHandle_Standard_Type@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Transient __thiscall Standard_Transient::This(void)const " (?This@Standard_Transient@@UBE?AVHandle_Standard_Transient@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Standard_DomainError::Throw(void)const " (?Throw@Standard_DomainError@@EBEXXZ)
testbrep.obj : error LNK2019: unresolved external symbol "public: __thiscall Standard_Failure::Standard_Failure(char * const)" (??0Standard_Failure@@QAE@QAD@Z) referenced in function "public: __thiscall Standard_DomainError::Standard_DomainError(char * const)" (??0Standard_DomainError@@QAE@QAD@Z)
testbrep.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Standard_Transient::~Standard_Transient(void)" (??1Standard_Transient@@UAE@XZ) referenced in function "public: virtual __thiscall Standard_Failure::~Standard_Failure(void)" (??1Standard_Failure@@UAE@XZ)
testbrep.obj : error LNK2019: unresolved external symbol "public: void __thiscall Standard_Failure::Destroy(void)" (?Destroy@Standard_Failure@@QAEXXZ) referenced in function "public: virtual __thiscall Standard_Failure::~Standard_Failure(void)" (??1Standard_Failure@@UAE@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Type const & __thiscall Standard_Failure::DynamicType(void)const " (?DynamicType@Standard_Failure@@UBEABVHandle_Standard_Type@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Standard_Failure::Throw(void)const " (?Throw@Standard_Failure@@MBEXXZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Type const & __thiscall Standard_RangeError::DynamicType(void)const " (?DynamicType@Standard_RangeError@@UBEABVHandle_Standard_Type@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Standard_RangeError::Throw(void)const " (?Throw@Standard_RangeError@@EBEXXZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Type const & __thiscall Standard_OutOfRange::DynamicType(void)const " (?DynamicType@Standard_OutOfRange@@UBEABVHandle_Standard_Type@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Standard_OutOfRange::Throw(void)const " (?Throw@Standard_OutOfRange@@EBEXXZ)
testbrep.obj : error LNK2001: unresolved external symbol "public: virtual class Handle_Standard_Type const & __thiscall Standard_DimensionError::DynamicType(void)const " (?DynamicType@Standard_DimensionError@@UBEABVHandle_Standard_Type@@XZ)
testbrep.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall Standard_DimensionError::Throw(void)const " (?Throw@Standard_DimensionError@@EBEXXZ)
D:\samples\standard\mfc\02_TopologySamples\testbrep\Debug\testbrep.exe : fatal error LNK1120: 24 unresolved externals
Build log was saved at "file://d:\samples\standard\mfc\02_TopologySamples\testbrep\testbrep\Debug\BuildLog.htm"
testbrep - 25 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Sharjith Naramparambath's picture

Hi,
This is the link error which is due to improper setting of the lib directory in the project settings page. There is a combo box which shows include, bin, library, source etc. You have to set the diectory to ros/win32/lib. For the generated code to have all declarations and preprocessor directives the best way to get rid of all errors is create a project with the VC6 appwizard (it does all the necessary settings for you) and convert the project into VS2005 by loading into it. This is what I do.

Hope this helps

Regards
N. Sharjith

stifan's picture

THINK YOU FOR REPLAY:
THE NOW, my code compile without any problème. think you, for help, and think you for any think.
i would like, now to read and write a step file and translate him a BREP model , can you help me for this.
if you have a code for this, please send me this code in my adresse : feridmeca@yahoo.fr
think you ............

stifan's picture

hi;
would you help me to solve the erreur link2001;

THIS IS MY CODE "read and write a step file"

STEPControl_Reader myStepReader;
Standard_Integer nstepFaces,nbreTransFaces;

myStepReader.ReadFile ("D://Documents and Settings//ferid sablaoui//Mes documents//farid//piece1.STEP");

Handle(TColStd_HSequenceOfTransient) myList1 = myStepReader.GiveList("step-faces");

nstepFaces = myList1->Length();
nbreTransFaces = myStepReader.TransferList(myList1);
cout<<"STEP Faces: "<