[Resolved] Compilation issues involving boost::function and GCC

Resolution: It seems that GCC does not like anonymous structs defined inside of functions being passed as the arguments. So in order to make it compile and such for the time being, I simply defined the structs at the top of the file and changed the other code accordingly. I hope this helps anyone else who might get stuck on this. Cheers. =]
I have been having this problem for a while, although I got it to compile by declaring the functor struct with ": function<void (Player *)>" after it. However, this only got it to compile rather than actually work. So I am hoping that someone here might have a possible solution for the problem. Now onto the code and such.
if (command == "me") {
if (args.length() == 0)
return;
string msg = player->getName() + " : " + args;
struct {
void operator()(Player *gmplayer) {
if (gmplayer->isGM() == true) {
PlayerPacket::showMessage(gmplayer, msg, 6);
string msg;
} sendMessage = {msg};
Players::Instance()->run(sendMessage);
The errors:
GCC wrote:ChannelServer/ChatHandler.cpp||In function 'void ChatHandler::handleChat(Player*, PacketReader&)':
ChannelServer/ChatHandler.cpp|163|error: no matching function for call to 'Players::run(ChatHandler::handleChat(Player*, PacketReader&)::<anonymous struct>&)'
ChannelServer/Players.h|47|note: candidates are: void Players::run(boost::function<void ()(Player*)>)
If it helps, this is the declaration of the Players::run function.
void run(function<void (Player *)> func);
Thanks in advance for any help you all can give. Cheers. =]
Last edited by emily (2008-12-24 22:05:58)

Good thing you found a solution.
I've had similiar problems from time to time.
One of the few part of C++ I don't like... Include .h here and there, forward declarations etc, becomes a mess after a while if you've got lots of files.

Similar Messages

  • Performance issues involving tables S031 and S032

    Hello gurus,
    I am having some performance issues. The program involves accessing data from S031 and S032.  I have pasted the SELECT statements below.  I have read through the forums for past postings regarding performance, but I wanted to know if there is anything that stands out as being the culprit of very poor performance, and how it can be corrected.  I am fairly new to SAP, so I apologize if I've missed an obvious error.  From debugging the program, it seems the 2nd select statement is taking a very long time to process. 
    GT_S032: approx. 40,000 entries
    S031:    approx. 90,000 entries
    MSEG:    approx. 115,000 entries
    MKPF:    approx. 100,000 entries
    MARA:    approx. 90,000 entries
    SELECT
      vrsio          "Version
      werks          "Plan
      lgort          "Storage Location
      matnr          "Material
      ssour          "Statistic(s) origin                  
    FROM s032
    INTO TABLE gt_s032
    WHERE ssour = space                                           AND   vrsio = c_000                                           AND   werks = gw_werks.
    IF sy-subrc = 0.
      SELECT
        vrsio        "Version
        werks        "Plant
        spmon        "Period to analyze - month
        matnr        "Material
        lgort        "Storage Location
        wzubb        "Valuated stock receipts value
        wagbb        "Value of valuated stock being issued
      FROM s031
      INTO TABLE gt_s031
      FOR ALL ENTRIES IN gt_s032
      WHERE ssour = gt_s032-ssour                                     
      AND   vrsio = gt_s032-vrsio                                     
      AND   spmon IN r_spmon
      AND   sptag = '00000000'                                      
      AND   spwoc = '000000'                                          
      AND   spbup = '000000'                               
      AND   werks = gt_s032-werks
      AND   matnr = gt_s032-matnr
      AND   lgort = gt_s032-lgort
      AND   ( wzubb <> 0 OR wagbb <> 0 ).
    ELSE.
      WRITE: 'No data selected'(m01).
      EXIT.
    ENDIF.
    SORT gt_s032 BY vrsio werks lgort matnr.
    SORT gt_s031 BY vrsio werks spmon matnr lgort.
    SELECT
      p~werks          "Plant
      p~matnr          "Material
      p~mblnr          "Document Number
      p~mjahr          "Document Year
      p~bwart          "Movement type
      p~dmbtr          "Amount in local currency
      t~shkzg          "Debit/Credit indicator
    INTO TABLE gt_scrap
    FROM mkpf AS h
    INNER JOIN mseg AS p
       ON hmblnr = pmblnr
      AND hmjahr = pmjahr
    INNER JOIN mara AS m
       ON pmatnr = mmatnr
    INNER JOIN t156 AS t
       ON pbwart = tbwart
    WHERE h~budat => gw_duepr-begda
      AND h~budat <= gw_duepr-endda
      AND p~werks = gw_werks.
    Thanks so much for your help,
    Jayesh

    Issue with table s031 and with for all entries.
    Hi,
    I have following code in which select statement on s031 is
    taking long time and after that it shows a dump. What should I do instead of
    exceeding the time limit of execution of an abap program.
    TYPES:
      BEGIN OF TY_MTL,  " Material Master
        MATNR TYPE MATNR,   " Material Code
        MTART TYPE MTART,   " Material Type
        MATKL TYPE MATKL,   " Material Group
        MEINS TYPE MEINS,   " Base unit of Measure
        WERKS TYPE WERKS_D, " Plant
        MAKTX TYPE MAKTX,   " Material description (Short Text)
        LIFNR TYPE LIFNR,   " vendor code
        NAME1 TYPE NAME1_GP, " vendor name
        CITY  TYPE ORT01_GP, " City of Vendor
        Y_RPT TYPE P DECIMALS 3, "Yearly receipt
        Y_ISS TYPE P DECIMALS 3, "Yearly Consumption
        M_OPG TYPE P DECIMALS 3, "Month opg
        M_OPG1 TYPE P DECIMALS 3,
        M_RPT TYPE P DECIMALS 3, "Month receipt
        M_ISS TYPE P DECIMALS 3, "Month issue
        M_CLG TYPE P DECIMALS 3, "Month Closing
        D_BLK TYPE P DECIMALS 3, "Block Stock,
        D_RPT TYPE P DECIMALS 3, "Today receipt
        D_ISS TYPE P DECIMALS 3, "Day issues
        TL_FL(2) TYPE C,
        STATUS(4) TYPE C,
    END OF TY_MTL,
    BEGIN OF TY_OPG     , " Opening File
           SPMON TYPE SPMON,   " Period to analyze - month
           WERKS TYPE WERKS_D, " Plant
           MATNR TYPE MATNR,   " Material No
           BASME TYPE MEINS,
           MZUBB TYPE MZUBB,   " Receipt Quantity
           WZUBB TYPE WZUBB,
           MAGBB TYPE MAGBB,   " Issues Quantity
           WAGBB TYPE WAGBB,
    END OF TY_OPG,
    DATA :
           T_M  TYPE STANDARD TABLE OF TY_MTL INITIAL SIZE 0,
           WA_M TYPE TY_MTL,
           T_O  TYPE STANDARD TABLE OF TY_OPG INITIAL SIZE 0,
           WA_O TYPE TY_OPG.
    DATA: smonth1      TYPE spmon.  
    SELECT
      a~matnr
      a~mtart
      a~matkl
      a~meins
      b~werks
      INTO TABLE t_m FROM mara AS a
      INNER JOIN marc AS b
      ON a~matnr = b~matnr
    *  WHERE a~mtart EQ s_mtart
      WHERE a~matkl IN s_matkl
      AND b~werks IN s_werks
      AND b~matnr IN s_matnr   .
      endif.
    SELECT spmon
           werks
           matnr
           basme
           mzubb
           WZUBB
           magbb
           wagbb
            FROM s031 INTO TABLE t_o
            FOR ALL ENTRIES IN t_m
            WHERE matnr = t_m-matnr
            AND werks IN s_werks
              AND spmon le smonth1
              AND basme = t_m-meins.

  • Issue with boost-libs and PythonMagick

    I am attempting to write a script in Python, and when I try to import PythonMagick, I get the following error:
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python3.2/site-packages/PythonMagick/__init__.py", line 1, in <module>
    import _PythonMagick
    ImportError: /usr/lib/libboost_python.so.1.47.0: undefined symbol: PyClass_Type
    I saw a bug from several months ago here:
    https://bugs.archlinux.org/task/22800
    It seems to reference a similar issue, however with the age, it seems like the problem in that bug should be fixed by now, so I'm not sure if it's something different or not.
    Is there something I can do to fix this or am I SOL?  I am trying to keep it python3, rather than python2.

    Maybe the bindings wasn't rebuilt against the recent python update?
    Check if you have the latest boost-libs package (check against archlinux.org/packages), if you do, try rebuilding them. If it works, post a bug report on it.
    Last edited by Mr.Elendig (2011-08-20 02:27:35)

  • Compiling issue Involving IMAGES

    OK, here's the situation. I have an image directory in the directory that I have put all my source code in. I am attempting to use the IDE NetBeans. When I compile my code via command.prompt using the command
    java -classpath C:\JAVA\ divelog.DiveLog
    everything is peachy keen and all my images work.
    When I compile + execute my code via NetBeans, the applet loads but it doesn't seem to find any of my images. I've tried many different approaches to this problem such as giving a direct path
    new ImageIcon("C:\\JAVA\\images\\diveflag.gif"), JLabel.CENTER);
    and copying the images into the root of my directory
    but
    nothing seems too work.
    I am extremely new to this Java business, sry if this is a typical problem.
    -charmwhore

    [url http://jedit.org]jEdit can do all that for you too, and quite likely takes a lot less time to start. In fact, the code & comment block collapsing thing of Netbeans was copied from jEdit methinks. It doesn't have a GUI builder though, but I guess you haven't been using it in order to be able to follow the tutorial word to word?
    You talk about applets but 'divelog' is a tutorial for creating an application... just to make sure: you are writing an application, not an applet, right ? Applets have security restrictions which disallow, among other things, reading files from the local filesystem.
    I'm not a NetBeans user so I can't help you much with it...
    I'm not completely new to programming.To object oriented programming? You know, the basic idea is completely different from C, VB, Perl, etc ... Divelog mostly teaches you about building a gui and you learn about the important features only "on the side," the better explanations are elsewhere.... it's your brains & time though :)

  • Boost Function problem in Studio 12.2

    Hi,
    I'm having a problem compiling a simple boost::function declaration which worked fine with 12.1 (and gcc). Here's the test code:
    #include <boost/function.hpp>
    #include <string>
    int main(int argc, char* argv[])
    boost::function<void(std::string)> foo;
    Which produces the error:
    "boostfn.cc", line 7: Error: In this declaration "foo" is of an incomplete type "boost::function<void>".
    1 Error(s) detected.
    Compiler version:
    CC: Sun C++ 5.11 SunOS_i386 2010/08/13
    Boost version: 1.38.0.
    Command line:
    CC -g0 -DSOLARIS -features=tmplife -features=tmplrefstatic -erroff=wbadinitl,wbadasgl -library=stlport4 -I<path to boost> boostfn.cc
    Any ideas why this doesn't work?
    Thanks,
    Graham

    Thanks Steve, I see. So is there a list of such known issues? I didn't notice anything related to it in the Known Problems section of the docs (http://docs.sun.com/app/docs/doc/821-2414/gkezt?a=view). It's a shame, because this put us in a position where we need to upgrade to 12.2 due to a bug in 12.1, but this regression means we can't use 12.2.
    Cheers,
    Graham

  • SIT Issues - Undefined Functions and non-compilation

    Dear All,
    FIrst off hi! Am new to LabVIEW, SIT and the forums. I currently have an issue with SIT 4.0 that I hope you can help me with.
    Background:
    We are trying to move a Simulink model off of a Windows environment into a cRIO-9004. This will run the simulation on startup and will get its data and will pass its data via UDP links (2 x Transmits, 2 x Receives). The system will not have a host VI, it is to run stand-alone in that respect.
    Currently we have a model working fine in Simulink. It communicates both locally and over the network using custom UDP blocks that we wrote in C (and so have src for).
    Issues:
    Currently when we try to build a DLL from ANY model (even a simple output of a constant) the model will autocode into C and a DLL will build but when importing it into LabVIEW we are told that there are functions defined in the DLL that are not defined in the header (it lists a standard 21 functions [i.e. NISIT_<fn name>] ). The header seems to define a different 4 (or 5 - currently not to hand apologies) <Model name>_<fn name>. These are soemthing like Initialize, Update, Output, Terminate.
    So I cannot currently import. The 21 functions seem overkill to manually define in the header but am I wrong? Why is the SIT not writing the header correctly. This issue relates to a model without our UDP blocks, the UDP functionality would be added around the DLL in LabVIEW using standard LabVIEW function blocks.
    In addition, rather than directly importing the DLL we considered directly deploying a DLL with the UDP functions embedded in it. However, when using RTW in Simulink it autocodes to C fine, but upon compilation into a DLL is raises issues (in true MATLAB style, typically vague and non-helpful). Any ideas?
    Many thanks for any of your time,
    Rich
    Additional Info:
    LabVIEW 8.5 (with Real-Time Module)
    MATLAB 2007a
    MS VC++ 6.0
    The engineer who wrote the custom UDP blocks suggests that it might be an issue with using WinSock in his blocks
    Any other info please ask

    Adnan,
    Thank you for looking into this and I must apologise, my original post wasn't all that clear with hindsight. So I will answer you questions and try to be clearer on the situation:
    There are two situations and issues here.
    1) Any simlpe model (i.e. constant -> output, or say pulse_gen -> transfer_fn -> output) will happily compile and link to a DLL using you nidll.tlc and the makefile etc that it produces. When importing the DLL (just standard import, not using SIT Connection Manager) I get an error, however:
    2) When exporting a DLL (like above) it will load fine onto the target when using SIT Connection Manager, no errors like above.  We thought of using this method to do everything in Simulink and use the SIT connection manager as above to load it all. The issue we were having with this is that the UDP blocks that were custom written would not compile when using nidll.tlc and the makefile etc. It will run fine as an s-function in Simulink. The engineer who wrote the blocks thinks it might be that your makefile would not like the UDP blocks as they use Winsock and he assumes that the makefile will raise an error as winsock will not be in the LabVIEW environment.
    So to fully answer your questions:
    1) What are the exact codes?
    When examining the error in Situation 1 that's exactly what I get. Interestingly if I include all the header it lists on the right hand side (clearer in the following screen print) then LabVIEW hangs when adding parsing the "simstruc" headers: (N.B. if you are looking at the addresses of these images then ignore the name of this one!)
    The other error I'm getting with regards to the UDP blocks manifests as follows (ignore Paint in the background showing the Config Screen):
    2) Does the error occur for any model or just yours?
    The errors surrounding the missing functions concerns any model when importing (SIT Connection Manager seems not to mind). The error when compiling/linking the DLL surrounds just our model due to the UDP blocks
    3) Are the 21 undefined functions created by you or purely by the Simulink compiler?
    We haven't touched any of the files after they are thrown out of the compiler. The 21 or so functions it lists all begin NIRT_<FnName> (N.B. I previously posted wrongly stating NISIT_<FnName>. NIRT_ is correct) so I assume that's the compiler. The ones defined in the header (the 4) all start <ModelName>_<FnName>
    The functions I assume I want (copied from the produced header file - I have not edited it. RWFJMildModel is the name of the Model file. There are no instances of the letters NIRT):
    /* Model entry point functions */
    extern void RWFJMildModel_initialize(boolean_T firstTime);
    extern void RWFJMildModel_output(int_T tid);
    extern void RWFJMildModel_update(int_T tid);
    extern void RWFJMildModel_terminate(void);
    The ones LabVIEW finds in the DLL (due to the DLL_EXPORT I imagine) and not the header can be seen in previous screen prints.
    4) Are you using nidll.tlc as your System Target File?
    Yes all instructions provided online, in the SIT 4 help etc are followed and this includes using nidll.tlc:
    5) If the model you are trying to build does not use your custom UDP blocks, then why do you believe the issue is related to using WinSock in those blocks?
    The model we plan on using eventually currently includes the UDP blocks, although if we cannot import them we will wrap the UDP functionality around the "rest of the model DLL" in LabVIEW provided we get that working. The other models are simple (as in thrown together in less than 30 secs) and I have no reason to believe this, I think this confusion was caused by my terrible first post, apologies.
    Thank you for you help, it is much appreciated
    Rich
    P.S. My company blocks imagehosting sites so I cannot confirm if the screen prints are in place, in the right order etc. They should however all be there!

  • Compiling Packages, Functions, and Procedures Issues

    If you are in the editor for a package and attempt to compile a know good package under another schema (compiled in SQL+ and Toad), you receive the following errors:
    Error(21,5): PLW-06002: Unreachable code
    Error(131,7): PLW-07202: bind type would result in conversion away from column type
    (122) TN_EXISTS NUMBER := 0;
    (131) IF TN_EXISTS > 0 THEN ...
    When commenting a line with if you have something like the following it tells you there is a syntax error
    -- some comment here --
    When compiling a PL/SQL function that returns a Boolean, you get this error: Error(40,4): PLW-06002: Unreachable code

    Kris,
    I seem to have the same problem.
    Is there a way to 'deactivate' this behaviour, or do we need to wait for another Raport Release.
    This is basically preventing me from using Raptor at all for any PL/SQL development ;-(
    Wouter

  • Compiler error with default arguments and static template function

    Hi 
    The following does not compile with visual studio 2010 sp1, and compiles with gcc.
    #include <string>
    class A
    public:
       template<class T>
       static T& Get(const std::wstring&);
    class B
     public:
      void f(
        double d,
        double c =A::Get<double>(L"test"));
    int main()
        B b;
        b.f(5);
    It gives me the following error 
    error C2783: 'T & A::Get(const wchar_t *)' : could not deduce template argument for 'T'
    If I change Get to be global function and not static function of A, it compiles.

    It seems to be a compiler bug.  It fails in VS2012, but compiles in VS2013.
    For completion sake, the problem exists if A is a namespace containing Get.  But not if Get is global.
    The only solutions I can see are try to workaround the problem (make Get global) or upgrade to a newer version of VS.

  • Suppose in a Package Spec there are 3 functions and Package Body there are 5 functions will the package compile?

    Suppose in a Package Spec there are 3 functions and Package Body there are 5 functions will the package compile?

    Rather than asking these basic one-liner questions (When a package is created how many database objects are created?) why don't you explain what issues you are experiencing after you've read the documentation and tried things yourself.
    The forums are for people to help when they experience issues, not when they can't be bothered to read the documentation or searcht the web for the basic information that's already explained.
    Re: 2. How do I ask a question on the forums?
    Re: 1. Where can I find Oracle Documentation?

  • Sun Studio 12 CC compiler and gcc libraries

    Hi
    We are working on a porting project, Linux to Solaris. The software uses lots ot third party libraries. These libraries are compiled on Linux using gcc. They do not endorse Sun's CC compiler.
    Our project plans to use CC instead. Is it okay to build our software with CC (and fix all the portability issues we may have) and finally link it with all the third party libs created with gcc ? Is such kind of arrangement workable?
    Any advice would be really helpful.
    Thank you,
    Manish.

    Thank you for reporting the problem! I've submitted CR 6642662. It should be visible on web in a day or so.
    Boris

  • Hi from the last two days my iphone have very slow to open the apps and very slow when i check the notification window , it taking too much time to open when i tap to down . help me to resolve the issue.

    Hi,  from the last two days my iphone( iphone 4 with ios 5) have very slow to open the apps and very slow when i check the notification window , it taking too much time to open when i tap to down . help me to resolve the issue.

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore...
    iPhone Reset
    http://support.apple.com/kb/ht1430
    Try this First... You will Not Lose Any Data...
    Turn the Phone Off...
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... ( But can take Longer...)
    Release the Buttons...
    Turn the Phone On...
    If that does not help... See Here:
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • Having horrible service with 4GLTE I have had 3G for several weeks (I am not the only person I know having this problem), I have reset my network settings and it did not resolve the issue.  I am also unable to send SMS and text messages without them eithe

    Having horrible service with 4GLTE I have had 3G for several weeks (I am not the only person I know having this problem), I have reset my network settings and it did not resolve the issue.  I am also unable to send SMS and text messages without them either failing or not sending at all.  Is there an outage in the Cleveland, Ohio area (zip codes 44129, 44134, 44137) or anything else I can do to resolve this issue?

    Not that I'm a Verizon employee, but I have experience in the field. An LTE tower will only extend up to, on a perfect day, with no elevation, 6-7 miles. On a typical day, you will be lucky at four (4) miles. The three ZIP codes you've given are all within about a 12 mile radius. That would mean that 2-3 towers are currently down at the same time, and Verizon would know about it within the hour. Being it's Cleveland, I'm sure they would receive numerous calls regarding an outage of that size.
    My point is that if you're having issues in all three ZIP codes, chances are it's a phone issue. If you're handset is simply not receiving LTE, but still receiving 3G, that would signify a SIM card issue. You need to get your SIM card replaced.

  • I've problem with Game Center . I can't sign in Game Center on my iPad . I tap on the Game Center icon but the page is blank. I tried go to setting, my Apple ID appear but the page keep on loading and  nothing pop up. How to resolve this issue?

    I've problem with Game Center . I can't sign in Game Center on my iPad . I tap on the Game Center icon but the page is blank. I tried go to setting, my Apple ID appear but the page keep on loading and  nothing pop up. How to resolve this issue?

    Hi, bamboo64. 
    Try closing all open applications in multitasking and power cycling the device.  Once this is done test the results.  If the issue persists, I have included a couple troubleshooting articles that I would recommend going through. 
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Troubleshoot issues on an iPhone, iPad, or iPod touch
    If you haven't been able to connect to the iTunes Store:
    Make sure your date, time, and time zone are correct in Settings > General > Date & Time.
    Note: Time Zone may list another city in your time zone.
    Make sure that your iOS software is up to date by tapping Settings > General > Software Update (iOS 5 or later) or connecting your iOS device to iTunes and clicking Check for Update on your device's Summary page.
    Check and verify that you're in range of a Wi-Fi router or base station. If you're on a device with cellular service, make sure that cellular data is turned on from Settings > General > Cellular.
    Note: If connected to cellular data, larger items may not download. You may need to connect to Wi-Fi to download apps, videos, and podcasts.
    Make sure that you have an active Internet connection. You can check the user guide for your device for help with connecting to the Internet.
    Make sure that other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the Internet.
    Try resetting (turning off and then on again) your Wi-Fi router.
    If the issue persists, try troubleshooting your Wi-Fi networks and connections.
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Cheers,
    Jason H. 

  • TS1363 My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue?

    My iPod Nano 7th Generation couldn't be detected by iTunes when I plugged in. I tried resolving the issue by uninstalling the iTunes and then install it back again but yet still the same problem exist. Can you please help me to solve this issue? I have already updated to the latest version of iTunes on my Windows 8 and I cannot synchronize my iPod for the time being. Please do help me to solve this problem. Thank You.

    uninstall all iTunes,5 programes,this worked for me after reinstall them

  • I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    I have poor/no service on my iphone 6  in places that I do have service on my old iphone 5.  Takes 10 minutes to send text and webpages will not load but load within seconds on the iphone 5 and forget making a phone call.  How do i resolve this issue??

    Hey kristiac,
    Thanks for the question. If I understand correctly, you have no service on the iPhone. I would recommend that you read this article, it may be able to help the issue.
    If you can't connect to a cellular network or cellular data - Apple Support
    Thanks for using Apple Support Communities.
    Have a good one,
    Mario

Maybe you are looking for