Jump to content
OMRON Forums

Classes within or outside of CPLCs


shansen

Recommended Posts

How do I go about creating a C/C++ class within a CPLC/Capp, or in a separate class that I can call [i]from[/i] a CPLC/Capp? I don't see the option in the Power PMAC IDE to add a "class" file to the project. I've tried adding the most basic class to a CPLC: [i]class TestClass { };[/i] But it reports a syntax error, and will not compile. I'm not sure why it will not compile, as this is standard C++ syntax.
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I think I have answered my own question... It seems that CPLC's can be written only in C, not C++. For some reason one of my Delta Tau programming PDFs indicates that CPLC's can be written in C++. It looks like that is either not the case, or it has not been implemented yet.
Link to comment
Share on other sites

PowerPMAC/ IDE project system only support C language and not c++. Atul [quote='shansen' pid='575' dateline='1280273408'] I think I have answered my own question... It seems that CPLC's can be written only in C, not C++. For some reason one of my Delta Tau programming PDFs indicates that CPLC's can be written in C++. It looks like that is either not the case, or it has not been implemented yet. [/quote]
Link to comment
Share on other sites

  • 5 months later...
What about compiling C++ outside of the PMAC IDE system (i.e. at the Linux command prompt)? For example, I created the following file (hello.cpp) as an experiment: [code] #include #include "gplib.h" #include "RtGpShm.h" using namespace std; int main() { cout << "Hello World!" << endl; InitLibrary(); while(true) { cout << pshm->ServoTime << "," << pshm->Motor[5].DesPos << "," << pshm->Motor[5].ActPos << endl; } return 0; } [/code] I can compile/link it using the following command: g++ -I /opt/ppmac/libppmac -I /opt/ppmac/rtpmac -L /opt/ppmac/libppmac -l ppmac -l rt hello.cpp -o hello However, I get an error when I run hello: error while loading shared libraries: libppmac.so Running "ldd hello" confirms that the library is not found, but I have not been able to resolve the error. If I comment out the InitLibrary() command, I can run the program, but the initialization of pshm has not been done so the program crashes. Does anyone know how to resolve the libppmac.so issue? Also, is there any plan to allow C++ code within the IDE?
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...