We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

[newbie] how to attach a debugger to ArchiCAD-Addons in Visual Studio 2022?

Tran Thanh Lo
Booster

Hi guys,

I'm just a newbie in ArchiCAD API programming, I used the addon template and built the example code in API Development Kit. Now, I want to learn how to debug in Visual Studio 2022. Can you help me? If yes, can you show me step by step?

Thank you very much.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Joel Buehler
Enthusiast

1. download and install the visualizer and put them in the folder where the steps tell you:

https://archicadapi.graphisoft.com/tools-for-debugging

 

2. go to the properties of your project (right click):

JoelBuehler_0-1693301429256.png

 

 

3. define where your archicad.exe sits under "debugging"

JoelBuehler_1-1693301511340.png

 

4. start archicad with "start new instance" (again right click on your project)

JoelBuehler_2-1693301560195.png

 

5. set your break points where you want and use VS like you waht with the step in etc commands. 

JoelBuehler_3-1693301649197.png

 

 

 

good luck 😄

 

 

View solution in original post

5 REPLIES 5
Solution
Joel Buehler
Enthusiast

1. download and install the visualizer and put them in the folder where the steps tell you:

https://archicadapi.graphisoft.com/tools-for-debugging

 

2. go to the properties of your project (right click):

JoelBuehler_0-1693301429256.png

 

 

3. define where your archicad.exe sits under "debugging"

JoelBuehler_1-1693301511340.png

 

4. start archicad with "start new instance" (again right click on your project)

JoelBuehler_2-1693301560195.png

 

5. set your break points where you want and use VS like you waht with the step in etc commands. 

JoelBuehler_3-1693301649197.png

 

 

 

good luck 😄

 

 

Hi Joel Buehler,

Thank you for your response.

but I still can't debug. Can you watch the video and give me some advice?

im sorry, i never managed to get archicad 25 running in the debug mode, only 26. =( i never found out waht the problem was. do you have a ac26 at hand? 

furthermore i dont see any debug information from your plugin in the output window, do they at least work?  like ACAPI_WriteReport() or DBPrintf (); they should be shown in the debug window....

 

and last question, just to be sure: your function "GettAllMorph()" geht called, right? =D (Not a another one that just happens to also show OK11)

Thank you very much, Joel Buehler

I tried it on ArchiCAD 26 and it worked. Can I ask you one more question? Now I code and debug on ArchiCAD 26, so how can I run the addon on ArchiCAD 25 or another one?

Thank you very much.

im glad it works now 🙂 

 

no, im afraid not: we only have forward compabillity and no backward. =( 

this post explains a lot of the mindset behind graphisofts api compability: 

 

https://archicadapi.graphisoft.com/documentation/compatibility

 

the post they link is also read worthy:

 

https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B

 

waht i would do if i have to etablish backward compability of my plugin:

 

1. finish the plugin in the version 26 since documentation and examples are in the best state in the newest version

2. when evrything runs fine i would create a new plugin from the template but as a 25 version

3. transfer all the working code to the 25 version. 

4. hope i dont have to do to much maintance and new features on both codebases.  

 

there are a few calls and structs that are different from 25 to 26 and are not directly portable. i encountered only a few and the ones that gave me trouble where in the element region. 

but this is more a hack then anything elese... and only works fine if you develop the plugin alone. 

 

the best solution would be to make a library with all the interchangable code. something like this:

JoelBuehler_0-1693382163814.png

 

but something like this could get very fast very unnecessary complex just for the sake of a "clean" solution.