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!

Cannot compile AC26 addon for AC27

YourQS
Booster

I have a plugin that compiles and works fine in AC26.   I am upgrading it to AC27.   I have installed the AC27 API kit and changed all references in the project file to the 27.3001 folder.

I now get about 6000 errors, many of them like these:

 

Code: 

 

 

CParameter* Factory(const API_AddParType &parameter);

 

 

 

Errors:

 

 

 

Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Error C2143 syntax error: missing ',' before '&'

 

 

 

The Visual Studio IDE is able to identify the type API_AddParType and can navigate to the .h file if I press F12 on the type, but the compiler doesn't seem to be able to find it. (See attached image)

 

Could someone help with what I need to change to resolve this issue?

 

AC27.PNG

 

25 REPLIES 25

Hi Nick,

I gave it a look and was able to get rid of a few errors but unfortunately not all. I don't think there's one single simple solution to solve all of the compilation errors.
Some things that I did:

  • Set C++ Language standard C++17
  • Move C:\Program Files\GRAPHISOFT\API Development Kit 27.3001\Support\Inc to the top of the include directories
  • Add CADInfrastructureBaseImp.LIB to the solution and use the corresponding folder header folder in project include directories
  • Add Geometry Module to project include directories
  • Include ACAPInc.h in AttributeCache.hpp and Element.hpp
  • Fix API_Pen (Pen.hpp) (That's an AC27 fix)
  • In Layer.cpp use ACAPI_CreateAttributeIndex

Getting the include directories right should fix a bunch of issues. Although some includes still don't work as I'd expect and as you've also found previously.
But maybe this things give you at least some path forward.

Hope that helps,
Bernd

After spending 2-3 hours trying to make it work I found a few major issues:

- you have an Object.hpp both in your add-on's files and in GSRoot, that confuses the compiler. Please rename the file to CObject.hpp and update its references. You may run into similar situations with Attribute.hpp, Element.hpp, and ModelElement.hpp.

- as API_AttributeIndex is no longer an integer but a class on its own, you must modify your code in several places to handle that properly.

- clean up includes, as Bernd mentioned above

- define UNICODE at the project level, and clean up the warnings and errors afterwards

Other issues:

- pens are available only through the pen tables

- some data members became `APIOptional`, you have to check if those have value before using them

- on the pure C++ side, several generic recommendations come to my mind → please look at C++ programming best practices.

 

Best, Akos

Hi Akos,

 

Thanks very much for spending the time on this, and you found the solution, which seems easy when you know the answer; multiple similarly names files.   This also explains why our plugin compiled for AC26, but wouldn't for AC27.

 

I have renamed the (+-7) files with duplicate names, and have got the errors down to just 8, and most of them refer to Graphisoft files in the C:\Program Files\GRAPHISOFT\API Development Kit 27.3001\Support\ area.   It seems highly unlikely there are problems in those files (Array.hpp, BM.hpp, and a Microsoft file xstddef) and is more likely to be a compatibility/version issue.   I have attached the updated project again.

I would really appreciate it if you could have a look at it.

AC27Errors.PNG

Solution

Hi,

 

Here's the modified project; I had to add a few #includes because my ATL installation was in a different directory. I recommend using a compare and merge tool to add the changes to your setup.

Both the Debug and Release x64 targets were compiled and linked properly; I left the Release add-on in the .zip in the Release directory.

 

Hope this helps,

Akos

 

Hi Akos,

 

Thank you very much for putting in all your effort to resolve this issue for us; I really appreciate it.

 

Regards,

Nick

Hi Nick,

 

You are welcome!

 

🙂 Akos