Skip to main content
Inspiring
May 24, 2022
Question

cant add socket to plugin.... warning C4005: 'AF_IPX': macro redefinition

  • May 24, 2022
  • 2 replies
  • 1174 views

Hey

I've gone over it for 8h now. Whatever I try, however, I try to import my sockets, they always break. It's like there is some kind of black magic path to import the socket library on windows..

 

I tried all here > https://www.zachburlingame.com/2011/05/resolving-redefinition-errors-betwen-ws2def-h-and-winsock-h/

 

Predeclaring, above, below after etc. I'm on 10th class/file away from main, I want to import socket there and I keep getting these damn errors. 

my mainPlugin import stuff >

 

 

 

 

#include "SocketLib/SocketIncludes/socket.h"
#include "PluginLib/Utilities/PIUASZString.h"

#include "iostream"
#include "PluginLib/Helpers/DocumentHierarchy.h"
#include "PluginLib/BaseSystems/CommandHandler.h"
#include <PIDefines.h>
#include <SPBasic.h>
#include <SPInterf.h>

#include <PIActionsPlugin.h>

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif


#include <assert.h>

#include <PIUSuites.cpp>
#include <PITerminology.h>

 

 

 

 

This is nuts, what do I do to just "Import a socket" here? Importing it like above "works" until I import it somewhere else in a header and it breaks. It's like I can't import it in a header at all. Only in CPP files.

 

Same goes with 

<PIUSuites.cpp>

Unless I import cpp in main, the plugin will not compile at all ;[

Regards

Dariusz

This topic has been closed for replies.

2 replies

Tom Ruark
Inspiring
May 24, 2022

Yes. Header file dependency and getting the correct order of includes is a huge pain. I would try this: 1) Get a winsock example that builds, 2) Modify it for your needs, 3) Wrap that in a DLL or LIB, 4) Load or link that in your plugin.

 

And this is why the SDK is documented for the specific tool chain version (Xcode or Visual Studio) so I can remove myself from this pain and suffering!

Inspiring
May 26, 2022

That's my experience too. It's like walking on glass sticks. 90% of explosion!

I managed to move vs solution to cmake & which made things A LOT easier. But still, the socket is a pain. Ended up predeclaring/using void* to handle it for now. 

 

Will try to move Xcode to cmake next, and see how that one... "explodes". Fun times!

 

In terms of sdk fun... do you also > 

#include <PIUSuites.cpp>

cpp in main? Seems like it has to be included in main so it can run properly, other classes appear to be happy with .h includes etc.

 

Regards

Dariusz

PECourtejoie
Community Expert
Community Expert
May 24, 2022

Hi, is this well related to Photoshop?

Inspiring
May 24, 2022

@PECourtejoie 

Photoshop SDK. There are so many... "flags" to get to even compile/run the code on that I have no idea what 50% of them do. It's a miracle it even compiles as-is. I ended up just doing void* for half the imports that break and doing a zillions of static_cast to make it run. I probably did something wrong. But I've no idea what 😕😕 

SDK can break even if I go from <PIUSuites.h> to "PIUSuites.h" by accident/auto-import etc etc. 

 

I'm gonna try and start to disable some of the flags PS sets to see if I Can make it run with fewer of them so its more "modern". 

 

I'm guessing not many people have tried running custom sockets/networks within photoshop & thus not being a big problem? Or they all found a workaround, or I simply did something very very very bad. 

 

PECourtejoie
Community Expert
Community Expert
May 24, 2022

I would strongly suggest to wait a little for an answer, and there are a few scripters that visit daily, but I'm not sure that people that compile plugins visit so often.