Quaoar's Lesson04_HelloOpenCascade from gitlab - how to make it work with Code::Blocks

PeriscopeYun

Looking around for some CAD
Hello everyone,

I am learning open cascade and want to use it with Code::Blocks. I studied Quaoar's Lesson04_HelloOpenCascade from gitlab step by step. It works fine in Visual Studio 2022. But I have been stuck in Code::Blocks for quite a few weeks without success. Below is my whole process, could anyone help me out?

(1) Downloaded opencascade-7.6.0-vc14-64.exe and installed to D:\OpenCASCADE-7.6.0-vc14-64

(2) Start Code::Blocks 16.01 (already installed) and create a new project, Console Application, and name it “TryOCCT”

(3) Go to menu bar: Settings->Compiler->Search directories->Compiler

Add D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\inc

(4) Similarly, Settings->Compiler->Search directories->Linker

Add D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib

(5) Click OK

(6) Go to , Lesson04_HelloOpenCascade, Copy and paste the five files into my TryOCCT project: Viewer.h, Viewer.cpp, VIewerInteractor.h, ViewerInteractor.cpp and main.cpp

(7) Build and Run, first error in Viewer.cpp

m_hWnd = CreateWindow(L"OpenGLClass",…

error: cannot convert 'const wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'HWND__* CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|

Fix: Change CreateWindow to CreateWindowW (not sure if this is the right way)

(8) Build and Run again, many “undefined reference to…” type errors

Tried go to menu bar, Project->Build options->Search directories->Compiler

Add D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\inc

Project->Build options->Search directories->Linker

Add D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib​

(I know above is the same as what I did with the Settings menu)

Failed again

Then, go to Project->Build options->Linker settings->Link libraries

Add

D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKernel.lib​
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKMath.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKTopAlgo.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKBRep.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKPrim.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKOpenGl.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKV3d.lib
D:\OpenCASCADE-7.6.0-vc14-64\opencascade-7.6.0\win64\vc14\lib\TKService.lib

Nothing changed

Can anyone give me some help? Thanks a lot!

I attached the Code::Blocks project.



 

Attachments

  • TryOCCT.zip
    259.3 KB · Views: 1

PhGo

Looking around for some CAD
Hello
I think code::block use mingw .
And is not compatible with vc14 version of occt
You must download source file and build with cmake
But too difficult for me. I have try for Qt without success.
Too much dependencies!
If you have made progress. Write here how you do
 

PeriscopeYun

Looking around for some CAD
Thank you very much PhGo,

I think you are right. It seems CB + OCCT needs a lot of tricks and so far I have not made any progress but I will try further and see.

Best
 

PeriscopeYun

Looking around for some CAD
Thank you again PhGo,

My understanding is CB is used to build the source code here. I will try and update if I could make any progress.

Best
 

DanB

CAD community veteran
Thank you again PhGo,

My understanding is CB is used to build the source code here. I will try and update if I could make any progress.

Best
I'm just being curious, what are the benefits of using Code::Blocks? I have not heard Code::Blocks mentioned since I took a C course at the uni 5 years ago.
 
Top