cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
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

 

View solution in original post

25 REPLIES 25

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
Mihaly Palenik
Graphisoft
Graphisoft

Hello,

 

at first as Bernd pointed out is there any reason you use angle brackets instead of quotes? Please try to modify to

#include "Parameter.hpp"

 

It is unclear to me whether this error you mentioned refers to CParameter or API_AddParType. Moreover API_AddParType is in APIdefs_LibraryParts.h but I cannot see where it is included. Please try to include it.

 

 

Hi Mihaly,

 

Thanks for taking a look at the problem we are having.

 

I did try changing the angle brackets to quotes when Berndt first suggested it, but the errors remained.   I think it is worth reiterating that the code (with the angle brackets) compiles fine when the references are to the AC26 API.   It only fails when the AC27 API is referenced.

 

I have tried including a reference to APIdefs_LibraryParts.h, but that also did not help.

 

Regards,

Nick

Akos Somorjai
Graphisoft
Graphisoft

Hi,

 

Have you tried to predeclare API_AddParType before its first use?

 

struct API_AddParType;

 

Best, Akos

YourQS
Booster

Hi Akos,

 

I added that line before the first reference to  API_AddParType, but the error output remained exactly the same.

 

Regards,

Nick