shansen Posted July 27, 2010 Share Posted July 27, 2010 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 More sharing options...
shansen Posted July 27, 2010 Author Share Posted July 27, 2010 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 More sharing options...
Omron Forums Support Posted July 28, 2010 Share Posted July 28, 2010 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 More sharing options...
michaelthompson Posted January 21, 2011 Share Posted January 21, 2011 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 More sharing options...
michaelthompson Posted January 21, 2011 Share Posted January 21, 2011 I figured it out. It compiles and links properly with the following command: [color=#000080]g++ -I /opt/ppmac/libppmac -I /opt/ppmac/rtpmac -L /opt/ppmac/libppmac -l ppmac -l rt [b]-Wl,-R/opt/ppmac/libppmac[/b] hello.cpp -o hello[/color][b][/b] Link to comment Share on other sites More sharing options...
Recommended Posts