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

Cannot compile AC26 addon for AC27

YourQS
Participant

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

 

5 REPLIES 5

Did you specify C++17 for your Project when compiling for AC27? The AC27 DevKit assumes the use of C++17. 

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

Hi Bernd, yes I had already set C++17 as the language standard, thanks, but that did not resolve these issues.

Hm.. I took a closer look. API_AddParType is defined for the AC27 DevKit. But CParameter is not.


In fact, when I copy your code line into one of my projects, I get the exact same errors and Visual Studio highlights CParameter as missing. So I think it's very likely that somehow you are not properly including the headers which define CParameter. Where do you get this type from?

Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

Hi Bernd,

It is one of our own classes defined in Parameter.hpp, which is included in the file. here is a large snippet showing the original code and  the include.   What is peculiar is that the VS IDE happily identifies CParameter, (no red squiggle) and I can navigate to it by pressing F12 on it in the IDE

 

Regards,

Nick

 

#ifndef _PARAMETERCOLLECTION_HPP_
#define _PARAMETERCOLLECTION_HPP_

#include "Definitions.hpp"

#include <vector>
#include "WString.hpp"
#include <Parameter.hpp>

using namespace std;

class CParameterCollection
{
protected:
vector<CParameter*> m_collection;

protected:
void ClearCollection();
void CopyCollection(const CParameterCollection &src);

CParameter* Factory(const API_AddParType &parameter);
 

 

Hi Nick,

 

It's a tough one. I don't see anything obviously wrong with the code.

A few questions:

  • Where is the file Parameter.hpp located? I'm wondering why you are including it with angle brackets instead of quotes.
  • Can you show the definition of CParameter? (Please use the function "Insert/Edit code sample" on here for better formatting of code)
  • Can you prepare a minimal example project without proprietary code where the compilation still fails? Ideally just CParameter definition + a file where it's included + the project definition. This might be a lot of work, but might help you debugging the issue and if you have a small example, you might be able to share it with us for us to investigate.

Best,
Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com