wxWidgets & Adobe Illustrator SDK

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Hello everyone!

I'm trying to use wxWidgets in an Illustrator plugin that I'm working on - but I keep getting this error when building:

Code: Select all

Build started...
1>------ Build started: Project: ArcPlugin, Configuration: Debug x64 ------
1>  performing: python ..\..\tools\pipl\create_pipl.py -input "[{\"name\":\"ArcPlugin\"}]"
1>ArcPlugin.cpp
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(213,37): error C2660:  'strcpy_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(27,30): message :  see declaration of 'strcpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(218,46): error C2660:  'strcpy_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(27,30): message :  see declaration of 'strcpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(220,49): error C2660:  'strcpy_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(27,30): message :  see declaration of 'strcpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(223,44): error C2660:  'strcpy_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(27,30): message :  see declaration of 'strcpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(232,56): error C2660:  'strcpy_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(27,30): message :  see declaration of 'strcpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(238,41): error C2660:  'strncpy_s': function does not take 3 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(55,30): message :  see declaration of 'strncpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(243,50): error C2660:  'strncpy_s': function does not take 3 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(55,30): message :  see declaration of 'strncpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(245,53): error C2660:  'strncpy_s': function does not take 3 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(55,30): message :  see declaration of 'strncpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(248,48): error C2660:  'strncpy_s': function does not take 3 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(55,30): message :  see declaration of 'strncpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(257,60): error C2660:  'strncpy_s': function does not take 3 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(55,30): message :  see declaration of 'strncpy_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(293,37): error C2660:  'strcat_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(34,30): message :  see declaration of 'strcat_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(298,46): error C2660:  'strcat_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(34,30): message :  see declaration of 'strcat_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(300,49): error C2660:  'strcat_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(34,30): message :  see declaration of 'strcat_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(303,44): error C2660:  'strcat_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(34,30): message :  see declaration of 'strcat_s'
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(312,56): error C2660:  'strcat_s': function does not take 2 arguments
1>c:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt\string.h(34,30): message :  see declaration of 'strcat_s'
1>Done building project "ArcPlugin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
... and the WX code in my plugin project...

Code: Select all

#include "wx\frame.h"
...
ASErr ArcPlugin::AddPanelControls()
{
	AIErr error = kNoErr;

	AIPanelPlatformWindow hDlg = NULL;

	error = sAIPanel->GetPlatformWindow(fPanel, hDlg);
	
	wxFrame* pluginPanelWX = new wxFrame(
		NULL,
		wxID_ANY,
		"",
		{ 400, 400 },
		{ 400, 400 },
		wxBORDER_NONE,
		"ArcPluginPanelWindow"
	);

	pluginPanelWX->Show();

	return error;
}
I'm guessing there's a conflict between the Illustrator SDK and wxWidgets SDK, but I'm scratching my head as to how to fix this.

Anyone have any ideas?
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax »

Try #defining __STDC_WANT_SECURE_LIB__ to 0 before including any wx headers. You may have to play around with include orders to make it work.
Use the source, Luke!
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Thanks for the tip doublemax! Unfortunately it doesn't seem to fix the issue no matter where I put the definition. Hmmm...
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Here's what happens when I move the #define __STDC_WANT_SECURE_LIB__ 0 before my #include "IllustratorSDK.h".

Code: Select all

Build started...
1>------ Build started: Project: ArcPlugin, Configuration: Debug x64 ------
1>  performing: python ..\..\tools\pipl\create_pipl.py -input "[{\"name\":\"ArcPlugin\"}]"
1>ArcPlugin.cpp
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(213,14): error C3861:  'strcpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(218,14): error C3861:  'strcpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(220,14): error C3861:  'strcpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(223,14): error C3861:  'strcpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(232,14): error C3861:  'strcpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(238,14): error C3861:  'strncpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(243,14): error C3861:  'strncpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(245,14): error C3861:  'strncpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(248,14): error C3861:  'strncpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(257,14): error C3861:  'strncpy_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(293,14): error C3861:  'strcat_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(298,14): error C3861:  'strcat_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(300,14): error C3861:  'strcat_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(303,14): error C3861:  'strcat_s': identifier not found
1>c:\wxwidgets-3.1.5\include\wx\wxcrt.h(312,14): error C3861:  'strcat_s': identifier not found
1>i:\projects\illustrator-sdk\samplecode\arcplugin\arcplugin.cpp(30,2): error C3861:  'strncpy_s': identifier not found
1>Done building project "ArcPlugin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Rather than whine about the number of arguments, it just says this instead.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax »

This looks like you're using Visual Studio. Which version?
Use the source, Luke!
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Yep. Sorry for not including this info in the original post.

Visual Studio 2019 (16.10.4) and wxWidgets 3.1.5.
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 471
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax@work »

I found __STDC_WANT_SECURE_LIB__ only by looking through the header files and looking for the strcpy_s declarations. Maybe there's still something missing.

Code: Select all

c:\wxwidgets-3.1.5\include\wx\wxcrt.h(213,14): error C3861:  'strcpy_s': identifier not found
Somthing like this is still strange though. AFAIK wxWidgets does not use secure CRT functions.

The first error line is just this:

Code: Select all

inline char *wxStrcpy(char *dest, const char *src)
    { return wxCRT_StrcpyA(dest, src); }
but wxCRT_StrcpyA is defined as:

Code: Select all

#define wxCRT_StrcpyA    strcpy
So i can only assume that there is another setting / switch somewhere that maps strcpy to strcpy_s. But i couldn't find any place where this might happen.

@PB any ideas?
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

I'm a newbie with C++ development. Is it possible that I have something setup incorrectly in my project properties? I've followed what few relevant tutorials I could find about setting up VS to make sure I got everything setup correctly, but maybe I missed something? The properties for the demo projects and my Illustrator project are almost indentical, so I don't really think this is the problem, but I have no idea.

I can get the demo/sample projects to compile no problem as well as getting a hello world project working from scratch.
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 471
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax@work »

So you can build the samples that come with the Adobe SDK?

Can you also build the wxWidgets samples?
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Yep, I can build the Adobe SDK samples no problem, it's only when I try to use both SDKs in the same project does this error come up.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax »

Is the SDK publicly available? If yes can you post a link to the exact version you downloaded?

I assume you based your code on one of the samples? Which one exactly?
Use the source, Luke!
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

The 2021 SDK that I'm using can be found at the link below. However, I don't think it's publicly available (need an Adobe account to login and download).

https://console.adobe.io/servicesandapis

The 2017 SDK is publicly available here: https://www.adobe.com/devnet/illustrator/sdk.html

I don't think there's been any major changes between the two that would cause a problem like this, but I could be totally wrong.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidgets & Adobe Illustrator SDK

Post by doublemax »

I tested this with VS2017 and the 2017 Adobe SDK.

The file "IllustratorSDK.h" contains this:

Code: Select all

#ifdef WIN_ENV
 	#include "windows.h"
	#include <time.h>
	//The following defines were added to keep the methods cross platform after they were deprecated on Windows.
    #define strcpy strcpy_s
    #define sprintf sprintf_s
    #define strncpy strncpy_s
    #define strcat strcat_s
    #define _strdate _strdate_s
    #define fopen fopen_s
    #define _strtime _strtime_s
#endif
Which explains the errors.

All you need to do is include any wx headers before "IllustratorSDK.h. And you should always include "wx/wx.h" as first wx header.
Use the source, Luke!
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

Thanks for the help, doublemax! The str errors are gone now, but now I'm getting a completely different error (unresolved externals). Let me poke around and see if I can't fix this new error.

I really appreciate your help so far. :)
superfunction
In need of some credit
In need of some credit
Posts: 9
Joined: Sun Jul 25, 2021 11:52 pm

Re: wxWidgets & Adobe Illustrator SDK

Post by superfunction »

I got the unreferenced externals fixed (by changing platform toolset from v141 to v142) and my plugin is now compiling! I can get a dialog to show up when Illustrator boots! Woohoo!

Still running into other problems, but the first major barrier has been defeated.

Thanks for all the help doublemax!
Post Reply