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

Debug option not working on Windows with Archichad 25

sijocherian
Contributor

Dear Community,

I'm encountering a problem with debugging in Visual Studio on Windows. Despite setting up everything correctly, the breakpoints are not being hit, and Visual Studio warns that "No symbols have been loaded for this document." We have ensured that symbols are loaded from the system.

Also Enabled tools for debuggung on Windows as mentioned here.

 

Attached are screenshots of the debug output and our configuration for your reference. Any insights or advice on what we might be missing or doing wrong would be greatly appreciated.


Thw warning message on debug modeThw warning message on debug modeDebug configurationDebug configurationDebug output after attach prossess as Archichad.Debug output after attach prossess as Archichad.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
kolioi
Booster

Make sure the AddOn project is set as your startup project

Solution Explorer.jpg

You can change it from the solution properties

Solution Properties.jpg

Then clean and rebuild the project/solution. Check if a .pdb file has been created in the output directory. And finally follow the steps from the previous post to start debugging.

I noticed in your code you check if height is not zero. This way of comparing two numbers with decimal point is wrong because of their internal representation in the computers. Always use some accuracy when compare. Check for example Element_Test where you can find code like this

double len = vx * vx + vy * vy;
if (len < EPS) {
....
}

EPS is defined in RealNumber.h

static constexpr double	EPS = 1E-05;	/* 0.00001 Machinery zero for general purp. */

 

View solution in original post

5 REPLIES 5
poco2013
Mentor

FYI :  Can't help you with this one BUT -- This has been a continuing problem with some configurations and is also a problem with version 27 and VS 2022. There have been many complaints over the years. On the other hand, Graphisoft just recognized this as a bug with 27 and VS 2022 and logged it for further investigation. So maybe we'll see some resolution  in the near future -- or maybe not?

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Thank you for your response.

 

Could you advise on how to obtain execution logs for ARCHICAD, similar to the way logs are generated when starting ARCHICAD from a terminal on macOS? Also any tips for efficiently capturing these logs would be greatly appreciated, as they are crucial for our development and debugging efforts.

Viktor Kovacs
Graphisoft
Graphisoft

I don't have any problems with debugging Add-Ons, this is the way I do it, maybe it will help.

  1. Compile the Add-On.
  2. Load the Add-On in Archicad using Add-On manager. Make sure that you load the compiled Add-On by specifying it via the path of the Debug version of your Add-On.
  3. Set the Add-On project as startup project in Visual Studio, and set your installed Archicad.exe path as the command for debugging.
  4. Hit F5, it will start Archicad, and debugging should work.

ViktorKovacs_0-1699957294496.png

Please note that if the Add-On is not preloaded, the breakpoints will be active only when the Add-On is used, and before that you will see inactive breakpoints.

Solution
kolioi
Booster

Make sure the AddOn project is set as your startup project

Solution Explorer.jpg

You can change it from the solution properties

Solution Properties.jpg

Then clean and rebuild the project/solution. Check if a .pdb file has been created in the output directory. And finally follow the steps from the previous post to start debugging.

I noticed in your code you check if height is not zero. This way of comparing two numbers with decimal point is wrong because of their internal representation in the computers. Always use some accuracy when compare. Check for example Element_Test where you can find code like this

double len = vx * vx + vy * vy;
if (len < EPS) {
....
}

EPS is defined in RealNumber.h

static constexpr double	EPS = 1E-05;	/* 0.00001 Machinery zero for general purp. */

 

HI @kolioi  
Thanks for the reply. I tried with same setup but the .pdb was not created . Is it beacuse of the version issue?
This is my build output.

 

1>
1>
2>------ Rebuild All started: Project: AddOn, Configuration: Debug x64 ------
2>AddOnMain.cpp
2>ArchiCADElements.cpp
2>DataProcessor.cpp
2>MigrationUtils.cpp
2>SnaptrudeConnector.cpp
2>Utils.cpp
2>Generating Code...
2>ACAP_STATD.lib(ACAPlib_.obj) : warning LNK4099: PDB 'API_c.pdb' was not found with 'ACAP_STATD.lib(ACAPlib_.obj)' or at 'C:\Users\Sijo\Documents\snaptrude\snaptrude-poc\Build\Debug\API_c.pdb'; linking object as if no debug info
2>   Creating library C:/Users/Sijo/Documents/snaptrude/snaptrude-poc/Build/Debug/Test.lib and object C:/Users/Sijo/Documents/snaptrude/snaptrude-poc/Build/Debug/Test.exp
2>AddOn.vcxproj -> C:\Users\Sijo\Documents\snaptrude\snaptrude-poc\Build\Debug\Test.apx
2>Done building project "AddOn.vcxproj".
3>------ Skipped Rebuild All: Project: ALL_BUILD, Configuration: Debug x64 ------
3>Project not selected to build for this solution configuration 
========== Rebuild All: 2 succeeded, 0 failed, 1 skipped ==========
========== Rebuild started at 10:34 and took 12.662 seconds ==========

 

As we can see that there is no .pdb file were created. this causes the debugging prossess.
Any solution for this? Thanks in advance