Search Results

Search found 21062 results on 843 pages for 'argos void'.

Page 3/843 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Compiler error: Variable or field declared void [closed]

    - by ?? ?
    i get some error when i try to run this, could someone please tell me the mistakes, thank you! [error: C:\Users\Ethan\Desktop\Untitled1.cpp In function `int main()': 25 C:\Users\Ethan\Desktop\Untitled1.cpp variable or field `findfactors' declared void 25 C:\Users\Ethan\Desktop\Untitled1.cpp initializer expression list treated as compound expression] #include<iostream> #include<cmath> using namespace std; void prompt(int&, int&, int&); int gcd(int , int , int );//3 input, 3 output void findfactors(int , int , int, int, int&, int&);//3 input, 2 output void display(int, int, int, int, int);//5 inputs int main() { int a, b, c; //The coefficients of the quadratic polynomial int ag, bg, cg;//value of a, b, c after factor out gcd int f1, f2; //The two factors of a*c which add to be b int g; //The gcd of a, b, c prompt(a, b, c);//Call the prompt function g=gcd(a, b, c);//Calculation of g void findfactors(a, b, c, f1, f2);//Call findFactors on factored polynomial display(g, f1, f2, a, c);//Call display function to display the factored polynomial system("PAUSE"); return 0; } void prompt(int& num1, int& num2, int& num3) //gets 3 ints from the user { cout << "This program factors polynomials of the form ax^2+bx+c."<<endl; while(num1==0) { cout << "Enter a value for a: "; cin >> num1; if(num1==0) { cout<< "a must be non-zero."<<endl; } } while(num2==0 && num3==0) { cout << "Enter a value for b: "; cin >> num2; cout << "Enter a value for c: "; cin >> num3; if(num2==0 && num3==0) { cout<< "b and c cannot both be 0."<<endl; } } } int gcd(int num1, int num2, int num3) { int k=2, gcd=1; while (k<=num1 && k<=num2 && k<=num3) { if (num1%k==0 && num2%k==0 && num3%k==0) gcd=k; k++; } return gcd; } void findFactors(int Ag, int Bg, int Cg,int& F1, int& F2) { int y=Ag*Cg; int z=sqrt(abs(y)); for(int i=-z; i<=z; i++) //from -sqrt(|y|) to sqrt(|y|) { if(i==0)i++; //skips 0 if(y%i==0) //if i is a factor of y { if(i+y/i==Bg) //if i and its partner add to be b F1=i, F2=y/i; else F1=0, F2=0; } } } void display(int G, int factor1, int factor2, int A, int C) { int k=2, gcd1=1; while (k<=A && k<=factor1) { if (A%k==0 && factor1%k==0) gcd1=k; k++; } int t=2, gcd2=1; while (t<=factor2 && t<=C) { if (C%t==0 && factor2%t==0) gcd2=t; t++; } cout<<showpos<<G<<"*("<<gcd1<<"x"<<gcd2<<")("<<A/gcd1<<"x"<<C/gcd2<<")"<<endl; }

    Read the article

  • C++: why a self pointer of a struct automatically changes to void*

    - by Stone
    struct ptr{ int node; ptr *next; ptr(){} ptr(int _node, ptr *_next){ node=_node; next=_next; } }; struct list_t{ ptr *sht; int size; void push(int node){ size++; sht=new ptr(node,sht); } }shthead[100001], comp[200001], tree[200001]; The struct ptr is a smart pointer, be used as a linked list. But when I debug the code in gdb, I found that the ptr*'s were all converted to void*. GDB output: (gdb) pt ptr type = struct ptr { int node; void *next; public: ptr(void); ptr(int, void *); } However, I can still see the data of the struct if I covert them back to ptr* in gdb. What's the reason for this please?

    Read the article

  • Event Dispatching, void pointer and alternatives

    - by PeeS
    i have my event dispatching / handling functionality working fine, but there is one issue that i need to resolve. Long story short, here are the details. // The event structure struct tEventMessage { // Type of the event int Type; // (void*) Allows those to be casted into per-Type objects void *pArgument1; void *pArgument2; }; I am sending events from different modules in my engine by using the above structure, which requires a pointer to an argument. All messages are queued, and then dispatched on the next ::Tick(). It works fine, untill i try to send something that doesn't exist in next ::Tick, for example: When a mouse click is being handled, it calculates the click coordinates in world space. This is being sent with a pointer to a vector representing that position, but after my program quits that method, this pointer gets invalid obviously, cause local CVector3 is destructed: CVector2 vScreenSpacePosition = vAt; CVector3 v3DPositionA = CVector3(0,0,0); CVector3 v3DPositionB = CVector3(0,0,0); // Screen space to World space calculation for depth zNear v3DPositionA = CMath::UnProject(vScreenSpacePosition, m_vScreenSize, m_Level.GetCurrentCamera()->getViewMatrix(), m_Level.GetCurrentCamera()->getProjectionMatrix(), -1.0 ); // Screen space to World space calculation for depth zFar v3DPositionB = CMath::UnProject(vScreenSpacePosition, m_vScreenSize, m_Level.GetCurrentCamera()->getViewMatrix(), m_Level.GetCurrentCamera()->getProjectionMatrix(), 1.0); // Send zFar position and ScreenSpace position to the handlers // Obviously both vectors won't be valid after this method quits.. CEventDispatcher::Get()->SendEvent(CIEventHandler::EVENT_SYSTEM_FINGER_DOWN, static_cast<void*>(&v3DPositionB), static_cast<void*>(&vScreenSpacePosition)); What i want to ask is, if there is any chance i could make my tEventMessage more 'template', so i can handle sending objects like in the above situation + use what is already implemented? Can't figure it out at the moment.. What else can be done here to allow me to pass some locally available data ? Please can somebody shed a bit of light on this please?

    Read the article

  • returning a Void object

    - by Robert
    What is the correct way to return a Void type, when it isn't a primitive? Eg. I currently use null as below. interface B<E>{ E method(); } class A implements B<Void>{ public Void method(){ // do something return null; } }

    Read the article

  • JUnit: checking if a void method gets called

    - by nkr1pt
    I have a very simple filewatcher class which checks every 2 seconds if a file has changed and if so, the onChange method (void) is called. Is there an easy way to check ik the onChange method is getting called in a unit test? code: public class PropertyFileWatcher extends TimerTask { private long timeStamp; private File file; public PropertyFileWatcher(File file) { this.file = file; this.timeStamp = file.lastModified(); } public final void run() { long timeStamp = file.lastModified(); if (this.timeStamp != timeStamp) { this.timeStamp = timeStamp; onChange(file); } } protected void onChange(File file) { System.out.println("Property file has changed"); } } @Test public void testPropertyFileWatcher() throws Exception { File file = new File("testfile"); file.createNewFile(); PropertyFileWatcher propertyFileWatcher = new PropertyFileWatcher(file); Timer timer = new Timer(); timer.schedule(propertyFileWatcher, 2000); FileWriter fw = new FileWriter(file); fw.write("blah"); fw.close(); Thread.sleep(8000); // check if propertyFileWatcher.onChange was called file.delete(); }

    Read the article

  • 'WebException' error on back button even when calling 'void' async method

    - by BlazingFrog
    I have a windows phone app that allows the user to interact with it. Each interaction will always result in an async WCF call. In addition to that, some interactions will result in opening the browser, maps, email, etc... The problem is that, when hitting the back button, I sometime get the following error "An error (WebException) occurred while transmitting data over the HTTP channel." with the following stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result) at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2) at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadPool.WorkItem.doWork(Object o) at System.Threading.Timer.ring() My understanding is that it's happening because my app opened another app (browser, maps, etc) before it had the time to execute the EndMyAsyncMethod(System.IAsyncResult result). Fair enough... What's really annoying is that it seems it should get fixed by cloning the server-side method, only making it void with the following operation contract [OperationContract(IsOneWay = true)] but I'm still getting the error. What's worse is that the exception is thrown in a system-generated part of the code and, thus, cannot be manually caught causing the app to just crash. I simply don't understand the need to execute an Endxxx method when it's explicitely marked as OneWay and void. EDIT I did find a similar issue here. It does seem that it is related to the message getting to the service (not the client callback). My next question is: if I'm now calling a method marked AsyncPattern and OneWay, what exactly should I be waiting for on the client to be sure the message was transmitted successfully? This is new service definition: [OperationContract(IsOneWay = true, AsyncPattern = true)] IAsyncResult BeginCacheQueryWithoutCallback(string param1, QueryInfoDataContract queryInfo, AsyncCallback cb, Object s); void EndCacheQueryWithoutCallback(IAsyncResult r); And the implementation: public IAsyncResult BeginCacheQueryWithoutCallback(string param1, QueryInfoDataContract queryInfo, AsyncCallback cb, Object s) { // do some stuff return new CompletedAsyncResult<string>(""); } public void EndCacheQueryWithoutCallback(IAsyncResult r) { }

    Read the article

  • "javascript: void(0)" links sometimes break event handlers in internet explorer

    - by internet man
    A while back I ran in to a problem where after clicking an anchor with "javascript: void(0)" events just stopped firing. I read that following a link puts the page in a different state and in that different state events don't fire. Even though the link is not real, it sometimes confuses IE. Anyway, I removed the "javascript: void(0)"'s and the problem has not been seen again. Now, in a different application I am seeing the same thing... kinda. Clicking the "javascript: void(0)" sometimes has no ill effect. But then for some reason or another after clicking the bad link the page will stop working. Once this happens it will continue to happen consistently until the client machine is rebooted. After reboot, you are back to it sometimes happening. Crazy right? Reboot fixing a web page!?!?! So, my question is has anyone seen this before? Can anyone give an explanation for this issue? Any documentation on this issue? I can't seem to find anything on it again. Does this even make sense? I already know "javascript: void(0)" is bad practice... I am just looking to understand the issue. Specifically, this is IE7. Thanks for reading!

    Read the article

  • How to void authorized transaction in authorize.net gateway using ActiveMerchant

    - by m7d
    Goal: Only have successful purchases show up on a customer's billing statement. I don't want declined authorizations showing up on their billing statement (as seen in an online banking system) as pending. A customer often will accidentally input an incorrect billing address, for example, followed by a correct one. Together, the two attempts, one successful and one not both show up on their billing statement as pending prior to settlement. This can scare the customer as it looks potentially like they will be charged twice. Details: When I do an AUTH_CAPTURE (via ActiveMerchant's purchase) or an AUTH (via ActiveMerchant's authorize) which is declined and subsequently want to void that authorization (via ActiveMerchant's void) so as not to have it appear on a customer's billing statement as pending (even though it will settle out after a few days), the gateway can't find the transaction to void using the authorization code returned from the authorization or capture method calls on the gateway. This is specific to the authorize.net AIM gateway. Please advise. Thanks!

    Read the article

  • Getting a variable out of a Public Void (Android)

    - by James Rattray
    I have this code: hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { final MediaPlayer mp2 = MediaPlayer.create(Textbox.this, R.raw.hero); mp2.start(); } public void onNothingSelected(AdapterView<?> parentView) { } }); (The code basically runs when a new item is selected of a spinner and then plays a song, -which later will be a variable based on what was picked, but i'm fine as it is for now) Problem: And I want to be able to use 'mp2' out of this public void, (I want a button which pauses it) How can I do this? Please explain/show... Thanks alot James

    Read the article

  • Casting problem cant convert from void to float C++

    - by Makenshi
    as i said i get this horrible error i dont really know what to do anymore float n= xAxis[i].Normalize(); thats where i get the error and i get it cuz normalize is a void function this is it void CVector::normalize() { float len=Magnitude(); this->x /= len; this->y /= len; } i need normalize to stay as void tho i tried normal casting like this float n= (float)xAxis[i].Normalize(); and it doesnt work also with static,dynamic cast,reinterpret,const cast and cant make it work any help would be really apreciated... thank you .<

    Read the article

  • 'void' type not allowed here error (java) help?

    - by David
    When i try to compile this: import java.awt.* ; class obj { public static void printPoint (Point p) { System.out.println ("(" + p.x + ", " + p.y + ")"); } public static void main (String[]arg) { Point blank = new Point (3,4) ; System.out.println (printPoint (blank)) ; } } i get this error: obj.java:12: 'void' type not allowed here System.out.println (printPoint (blank)) ; ^ 1 error I don't really know how to start asking about this other than to ask: What went wrong here? What does this error message mean?

    Read the article

  • an error "variable of field declared void"

    - by lego69
    I have this code: header - test.h Inside header I have some class Z and definitions of two functions test and test2 I call function test2 from test void test2(Z z, Z const *za); this is implementation of the function: void test2(Z z, Z const *za){ int i = z; //this row works cout << i << endl; } I call it from test: test2(z1, za1); // za1 is pinter to object and z1 is some object but in my header I receive an 3 errors: Multiple markers at this line - initializer expression list treated as compound expression - `A' was not declared in this scope - variable or field `quiz2' declared void can somebody please explain why? thanks in advance

    Read the article

  • emacs error: "Symbol's value as variable is void: hostname"

    - by Florian Pilz
    After I installed emacs this error occurs every time on startup. It prevents me from installing plugins, e.g. auctex via aptitude. I already tried to install a plugin by hand (rails for ruby), but doesn't work. The error doesn't contain the message "hostname", but the hostname of my PC is displayed ("bloodredangel-ubuntu"). I changed my hostname to "bloodredangel", but the error message stays the same. While I changed my hostname I saw that in /etc/hostname were two entries: 127.0.0.1 bloodredangel-ubuntu I already asked this question in an ubuntu forum but they couldn't help. They recognised an misconfigured /etc/hosts file, which I corrected, but from time to time these incorrect configurations get attached by something. I didn't add them by hand, maybe it has something to do with the issue. The misconfigurations looked like this: 127.0.0.1 127.0.0.1 bloodredangel-ubuntu localhost.localdomain localhost 127.0.0.1 127.0.0.1:8080 bloodredangel-ubuntu localhost.localdomain localhost I didn't found a solution on the internet, so I hope I will find help here finally.

    Read the article

  • emacs error: "Symbol's value as variable is void: hostname"

    - by Florian Pilz
    After I installed emacs this error occurs every time on startup. It prevents me from installing plugins, e.g. auctex via aptitude. I already tried to install a plugin by hand (rails for ruby), but doesn't work. The error doesn't contain the message "hostname", but the hostname of my PC is displayed ("bloodredangel-ubuntu"). I changed my hostname to "bloodredangel", but the error message stays the same. While I changed my hostname I saw that in /etc/hostname were two entries: 127.0.0.1 bloodredangel-ubuntu I already asked this question in an ubuntu forum but they couldn't help. They recognised an misconfigured /etc/hosts file, which I corrected, but from time to time these incorrect configurations get attached by something. I didn't add them by hand, maybe it has something to do with the issue. The misconfigurations looked like this: 127.0.0.1 127.0.0.1 bloodredangel-ubuntu localhost.localdomain localhost 127.0.0.1 127.0.0.1:8080 bloodredangel-ubuntu localhost.localdomain localhost I didn't found a solution on the internet, so I hope I will find help here finally.

    Read the article

  • - (void)alertViewCancel:(UIAlertView *)alertView is not called

    - by Sean
    Hi all I've got the problem that the UIAlertViewDelegate method - (void)alertViewCancel:(UIAlertView *)alertView is not called when I cancel a AlertView with it's cancel button. Weird is that the delegate method - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex works perfectly. Does anyone have an idea? Thanks in advance Sean

    Read the article

  • Bitwise operation on void* in C#

    - by code poet
    So I am Reflector-ing some framework 2.0 code and end up with the following deconstruction fixed (void* voidRef3 = ((void*) & _someMember)) { ... } This won't compile due to 'The right hand side of a fixed statement assignment may not be a cast expression' I understand that Reflector can only approximate and generally I can see a clear path but this is a bit outside my experience. Question: what is Reflector trying to describe to me? Update: Am also seeing the following fixed (IntPtr* ptrRef3 = ((IntPtr*) & this._someMember))

    Read the article

  • access elements of a void *?

    - by user146780
    I have a void pointer and want to access elements from it. How could I transform a void * into an unsigned byte pointer so I can access its elements (which I know are actually unsigned bytes). Thanks Using C++

    Read the article

  • Warning: pointer of type 'void *' used in subtraction

    - by idealistikz
    Although it runs correctly, the following results in the aforementioned compiler warning: return ((item - (my->items))/(my->itemSize)); 'item' is a 'void *'; 'my-items' is a 'void *'; 'my-itemSize' is an 'int' Casting 'item' and 'my-items' as an 'int *' caused the program to run improperly. What is the best way to remove the warning?

    Read the article

  • +(void) initialize in objecive c class static variables construstor

    - by sugar
    I found some sample code from here. static UIImage *backgroundImageDepressed; /** * */ @implementation DecimalPointButton + (void) initialize { backgroundImageDepressed = [[UIImage imageNamed:@"decimalKeyDownBackground.png"] retain]; } is it something like this - +(void) initialize method initialize static variables of a class ( interface ) in objective c ? I have never seen this before. Please need your guidance on it. Thanks in advance for sharing your great knowledge. Sagar

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >