Incompatible Types in Assignment for CGPoint
hey i'm new to this and i'm not sure why i keep getting this problem.
TrainerViewController.h file:
#import <UIKit/UIKit.h>
@interface TrainersViewController : UIViewController {
IBOutlet UIButton *upMovementButton;
IBOutlet UIButton *downMovementButton;
IBOutlet UIButton *leftMovementButton;
IBOutlet UIButton *rightMovementButton;
IBOutlet UIButton *jumpMovementButton;
IBOutlet UIImageView *character;
CGPoint *characterVelocity;
NSTimer *_moveLeft;
NSTimer *_moveRight;
NSTimer *_moveJump;
@property(nonatomic,retain) IBOutlet UIButton *upMovementButton;
@property(nonatomic,retain) IBOutlet UIButton *downMovementButton;
@property(nonatomic,retain) IBOutlet UIButton *leftMovementButton;
@property(nonatomic,retain) IBOutlet UIButton *rightMovementButton;
@property(nonatomic,retain) IBOutlet UIButton *jumpMovementButton;
@property(nonatomic,retain) IBOutlet UIImageView *character;
@property(nonatomic) CGPoint *characterVelocity;
@property(nonatomic,retain) NSTimer *_moveLeft;
@property(nonatomic,retain) NSTimer *_moveRight;
@property(nonatomic,retain) NSTimer *_moveJump;
- (IBAction)characterMoveRightStart;
- (IBAction)characterMoveRightStop;
- (IBAction)characterMoveLeftStart;
- (IBAction)characterMoveLeftStop;
@end
TrainersViewController.m file:
#import "TrainersViewController.h"
#define gravityAcceleration 1
#define characterSpeedX 10
#define characterSpeedY 15
@implementation TrainersViewController
@synthesize character,leftMovementButton,rightMovementButton,downMovementButton,upMovementButton,jumpMovementButton,moveLeft,_moveRight,moveJump;
@synthesize characterVelocity;
- (void)viewDidLoad {
[super viewDidLoad];
characterVelocity = CGPointMake(characterSpeedX, characterSpeedY);
/*[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];*/
CGPointMake return a CGPoint while characterVelocity is of type CGPoint*, one is a struct the other is a pointer.
Similar Messages
-
Incompatible types in assignment
Hello everyone,
I'm quite new to objective-c programming. So far, i pretty much solved everything either on my own with the documentation, and with some googling. One problem i haven't solved was how to detect a swipe on a uiscrollview, but i thought i found another way to do it.
However, when i'm trying to get the contentoffset.x of my scrollview (named dayScrollView) and store it in a CGFloat, i get a compiler error ' incompatible types in assignment'. I have been able to access it just fine, however now it's giving me trouble.
I declared the float in the header file (CGFloat *deceleratingTouch), and then tried to store it in the implementation file (deceleratingTouch=dayScrollView.contentOffset.x;). What is possible that went wrong? as i said, i'm quite new, so i sometimes make the stupidest mistakes.Ok, it was solved. Apparently, CGFloat doesn't need the asterisk if you declare it in the header file. That's what i said about stupid mistakes
-
ORABPEL-10041 Trying to assign incompatible types
Hi,
I'm developing a BPEL process which takes an input xml file and inserts data into AP interface tables. I used a file adapter to read the input file and used applications adapter to import ap interface tables.
I use the assign activity to assign the number value from my xml file to the invoice_id column in the ap_invoices_interface column. I get the following warning. Can anyone please tell me how do I fix this. I have BPEL 10.1.2.2 installed.
Warning(29):
[Error ORABPEL-10041]: Trying to assign incompatible types
[Description]: in line 29 of "C:\OraBPELPM_1\integration\jdev\jdev\mywork\Workspace1\BPELProcess_TestInsert\BPELProcess_TestInsert.bpel", <from> value type "{http://www.w3.org/2001/XMLSchema}string" is not compatible with <to> value type "{http://www.w3.org/2001/XMLSchema}long".
[Potential fix]: Please make sure that the return value of from-spec query is compatible with the to-spec query.
ThanksThis is just a warning so it does not mean that your process will fail, e.g. string to decimal may work for the string holds a number, but will fail if it has a string.
So if you know the data you can safely ignore, otherwise you will have to do some transofrmation within an assign.
cheers
James -
Incompatible types error on a for loop
Hi. I am in the middle of making a program and a decided to make a print statment to check to make sure everything was organized as it should be and I got an incompatible types error for the line where I start my for loop - for (index = 0 ...) etc. Since everything is an int, I'm not sure how they're not compatible with each other.. thoughts? here's my code so far, thanks
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declarationthank you. here's the code.
import java.io.*; // needed for stream readers
import java.lang.*;
public class testScores extends Object
public static void main(String args[] ) throws Exception
// declare variables for input
String records;
String room_nbr_input;
String test_score_input;
String student_id;
int room_nbr_nbr;
int test_score_nbr;
int index;
String[] record = new String[3];
int[] room_nbr = new int[30];
int[] test_score = new int[30];
int[] kount = new int[30];
// created file reader and buffered reader
FileReader frM;
BufferedReader brM;
// open file
frM = new FileReader("einstein_testscores_2009.txt");
brM = new BufferedReader(frM);
// print headings
startUp();
// get one record from file
records = brM.readLine();
while(records !=null)
//split the record into three fields = the array record[], then assign those values to variables
record = records.split(", ");
student_id = record[0];
room_nbr_input = record[1];
test_score_input = record[2];
//change the data into integers
room_nbr_nbr = Integer.parseInt(room_nbr_input);
test_score_nbr = Integer.parseInt(test_score_input);
//put the variables into arrays
room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
//get new record
records = brM.readLine();
for (index = 0; index = room_nbr.length; index++)
System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
public static void startUp()
System.out.print("Einstein Elementary Test Scores\n\n");
System.out.print("Room Number\t\tTest Score Average\n\n");
} // end of class declaration -
Account assignment for Movt type 101 and 501
All SAP Gurus,
We want to do the account assignment for movt types 101, 102, 122, 123, 201, 202, 261, 262 accourding to the movement types.
We are aware that the Transaction Key is 'GBB'.
But how to know that which 'General Modification' is used for which movement types.
(in short where we can find this link between movement types and Transaction Key and 'General Modification')
Regards,To know this first you have to know what does the different general modifications means for GBB:
AUA: for order settlement
AUF: for goods receipts for orders (without account assignment)
and for order settlement if AUA is not maintained
AUI: Subsequent adjustment of actual price from cost center directly
to material (with account assignment)
BSA: for initial entry of stock balances
INV: for expenditure/income from inventory differences
VAX: for goods issues for sales orders without
account assignment object (the account is not a cost element)
VAY: for goods issues for sales orders with
account assignment object (account is a cost element)
VBO: for consumption from stock of material provided to vendor
VBR: for internal goods issues (for example, for cost center)
VKA: for sales order account assignment
(for example, for individual purchase order)
VKP: for project account assignment (for example, for individual PO)
VNG: for scrapping/destruction
VQP: for sample withdrawals without account assignment
VQY: for sample withdrawals with account assignment
ZOB: for goods receipts without purchase orders (mvt type 501)
ZOF: for goods receipts without production orders
(mvt types 521 and 531)
You can also define your own account groupings. If you intend to post goods issues for cost centers (mvt type 201) and goods issues for orders (mvt type 261) to separate consumption accounts, you can assign the account grouping ZZZ to movement type 201 and account grouping YYY to movement type 261
Then go and check OMWN.
Regards,
Indranil -
Document type assigned for other goods receipts(MB1C)is WA why?
Hi,
Document type assigned for other goods receipts(MB1C)is WA why?
ThanksDocument type for Goods Receipt is WE but I found in standard(Default) system it is assigned WA?
Can anyone help me on this?
Thanks -
Order type automatically assign to product wise for order
Hi all,
I gave 4 types of Orders for one plant as per products. The client ask me assign that orders automatically for each product in routing how i will assign please let me know.Actually routing has no relation to order type.
You can use Production Scheduling Profile as well as Production Scheduler/Supervisor.
Firstly, you need to create 4 Production Scheduling Profile and assign 4 Order Type to Prd Sch. Profile.
Then you need to assign the Profile to material in Work Scheduling view.
Another way is that you can create Production Scheduler/Supervisor and assign the Pro Sch Profile to the Prd Scheduler, then assign Prod Scheduler to Material Master in Work Scheduling view also.
From now on, whenever a production order is created for material, order type will be get from the Scheduling Profile.
To maintain the Prd Sch Profile and Prd Scheduler in IMG: Production > Shop Floor COntrol > Master Data -
Person type and assignment status for terminated employee
Hi,
When I terminate an employee, is it possible to default the field "type" on "Person type and assignment status for terminated employee" section into another value? Its default values is: "Ex-Employee released".
Thank you.Navigate to Work Structures -> Status and query for all rows with system status Terminated Assignment. select your required assignment status as Default. Untick the other default.
-
[SOLVED] XSD simpleType trying to assign incompatible types
Hi all!
I have a big XSD schema with complex and simple types defined. One of the simple types looks like this (string with min and max length defined):
<xsd:simpleType name="MySimpleType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1" />
<xsd:maxLength value="36" />
</xsd:restriction>
</xsd:simpleType>I assign (copy operation) a string variable to an element of this type. When I compile i get the trying to assign incompatible types warning. I know it's just a warning but I'd like to solve it. I thought I can create a variable of the same type, but I can't (if I try to define message type only the complex type from XSD are displayed).
Is there a way to get rid of this warning?
Thanksinstead of using a variable assignment use the expression builder to construct the 'bpws:getVariableData() equivalent of the variable assignment. The warning will no longer exist.
-
Invalid type assigned for CMR field
Hi at all,
I have two entity beans, customer and article. I model a CMR one to many relationship between customer and article; customer contains a collection of articles. I'm working on the J2EE reference implementation. When verifying the application with the verifyer tool, I get the following error message:
For [ customerBean ]
Error : Invalid type assigned for container managed field [ article ] in bean [ customerBean ]
article in customerBean is of type Java.util.Collection. What's going wrong here?
Thx, ThomasWhat parameter do you pass to the method when you are setting the relationship? Collection of which objects? You should pass a collection of local interfaces.
Best regards,
Andrew -
Incompatible types - found java.lang.String but expected int
This is an extremely small simple program but i keep getting an "incompatible types - found java.lang.String but expected int" error and dont understand why. Im still pretty new to Java so it might just be something stupid im over looking...
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Lab
public static void main(String []args)
int input = JOptionPane.showInputDialog("Input Decimal ");
String bin = Integer.toBinaryString(input);
String hex = Integer.toHexString(input);
System.out.println("Decimal= " + input + '\n' + "Binary= " + bin + '\n' + "Hexadecimal " + hex);
}You should always post the full, exact error message.
Your error message probably says that the error occurred on something like line #10, the JOptionPane line. The error is telling you that the compiler found a String value, but an int value was expected.
If you go to the API docs for JOptionPane, it will tell you what value type is returned for showInputDialog(). The value type is String. But you are trying to assign that value to an int. You can't do that.
You will need to assign the showInputDialog() value to a String variable. Then use Integer.parseInt(the_string) to convert to an int value. -
Problem with incompatible types
Can you help me out where the problem is? The Child extends the Iterator<GenericTypeTest> so why the assignment doesn`t work? Thank you in advance
class GenericTypeTest implements Iterator<GenericTypeTest> {
public GenericTypeTest() {
Child a = null;
Iterator<GenericTypeTest> b = null;
b = a;
Set<Child> sa = null;
Set<Iterator<GenericTypeTest>> sb = null;
sb = sa; // HERE: COMPILATION PROBLEM
// (Incompatible types: found: Set<Child> required: Set<Iterator<GenericTypeTest>>)
public boolean hasNext() {
return false;
public GenericTypeTest next() {
return null;
public void remove() {
class Child extends GenericTypeTest {}You can only assign from a subtype to a supertype. And the subtype/supertype relationship for generic types isn't what you think it is. Read this FAQ entry for more information, especially the part around the sentence "The prerequisite is that at least one of the involved type arguments is a wildcard."
-
Compatible & Incompatible types
Why is that I can assign a integer value to a double variable, but cannot assign a double value to an integer variable? Aren't double and integer compatible types? Isn't there a concept of truncation in java? I searched the net but in vain. I couldn't find the exact answer I was looking for. So I am posting in this forum.
PS: I understand it is not possible to assign an integer to a string since they are incompatible types.
Edited by: 964980 on Mar 26, 2013 9:29 PMWhy is that I can assign a integer value to a double variableBecause it's a widening conversion that doesn't lose any information. See JLS #5.1.2.
but cannot assign a double value to an integer variable?Because it's a narrowing conversion that might lose information. You can do it as long as you write an explicit typecast. See JLS #5.1.3.
Aren't double and integer compatible types?No, see above.
Isn't there a concept of truncation in java?Yes, see above.
@rp0428 I don't see what good asking for the code and the error message does, in a fundamental case like this. It doesn't change the answer, and your own answer (is/isn't) wasn't too inspiring. -
Compiler error: incompatible types
When I try to compile this code it gives the error "incompatible types".
import java.util.ArrayList;
public class Poly {
public static void main (String args[]) {
Number integer = new Integer(1);
ArrayList<Number> integers = new ArrayList<Integer>();
}Assigning a Number object an Integer which extends Number works fine.
But when I try to assign an ArrayList<Number> object an ArrayList<Integer> object it gives an imcompatible types error.
Shouldn't it work?
Edited by: aexyl93 on Jun 7, 2010 2:00 AM
Edited by: aexyl93 on Jun 7, 2010 2:05 AMaexyl93 wrote:
Thanks for the quick replies.
I've never seen ArrayList<? extends obj> before.Nitpick: it's not "? extends obj" it's "? extends SomeClass".
"obj" kind of implies that you could use a variable/field here, which is wrong.
I thought it would be able to hold an object which extends what it's supposed to hold.A List<? extends Number> could contain any class that extends Number (as well as Number itself if it weren't an abstract class). However you can't add anything (except null), because you don't know the concrete type at this point. -
Sample 1:
public interface I<T extends I<?>>
I<? extends I<T>> m1 ();
public class Z<T extends I<?>> implements I<T>
public I<? extends I<T>> m1 ()
return m2();
protected I<? extends I<T>> m2 ()
return null;
javac Z.javacompiled with no problems
Sample 2:
public interface I<Tx, T extends I<Tx, ?>>
I<Tx, ? extends I<Tx, T>> m1 ();
public class Z<Tx, T extends I<Tx, ?>> implements I<Tx, T>
public I<Tx, ? extends I<Tx, T>> m1 ()
return m2();
protected I<Tx, ? extends I<Tx, T>> m2 ()
return null;
javac Z.javaZ.java:5: incompatible types
found : I<Tx,capture of ? extends I<Tx,T>>
required: I<Tx,? extends I<Tx,T>>
return m2();
^
1 error
Well... can anyone help with this? Or at least some explanations why adding second generic generates this problem?The problem is in the recursion, not in the second type argument. If you changed your first interface from
public interface I<T extends I<?>> {} to
public interface I<T extends I<T>> {} you would run into the same error message. For sake of clarity let's discuss the issue using your first example in a slightly simplified form:
public interface I<T extends I<T>> {}
public class Z<E>
public I<? extends I<E>> m1 ()
return m2();
/* error: incompatible types
found : I<capture of ? extends I<E>>
required: I<? extends I<E>>
return m2();
^
protected I<? extends I<E>> m2 ()
{ return null; }
}The error message is not awfully helpful, because the "E" is different in both types.
Method m2 returns a reference of type I<capture of ? extends I<E>>, where E extends I<capture of ? extends I<E>>, that is, it returns a concrete instantiation of the interface, namely I<SomeType> with a type that extends I<SomeType> with a type that extends ... continued recursively.
On the other hand, method m1 is supposed to return a reference of type I<? extends I<E>>, where E extends I<? extends I<E>>, that is, it returns a wildcard instantiation of the interface, namely I<? extends I<SomeType>> with a type that extends I<? extends I<SomeType>> with a type that extends ... continued recursively.
And here is the point: The first construct leads to a concrete instantiation like a List<List<List<String>>>. The second construct lead to a recursive wildcard instantiation like List<? extends List<? extends List<?>>>. As soon as the wildcard appears on a nested level, the types are no longer compatible.
It's like assigning a List<List<String>> to a List<List<?>>. It's not permitted because the first is a list of string-lists and the second is a list of mixed-lists. You cannot assign one to the other.
In your example, changing
public interface I2<Tx, T extends I2<Tx, ?>> to
public interface I2<Tx, T extends I2<?, ?>>might do the trick.
(As usual, ignore the annoying additional angle brackets.)
Maybe you are looking for
-
Adobe 3D Reviewer: "renaming"doesn't work!
Hello, I'm an applied scientist doing numerical modeling and visualization. In the research group we used Acrobat 3D as a better way to communicate with colleagues and our clients. I just downloaded the trial version of Acrobat 9 Pro extended and had
-
Number to fractional string not working correctly
I am measuring some parameters from oscillsocpe. i need to write these values to text file for which i am using write to spreadsheet, but what is happening is it is always writing zero value to file, on debugging i found that while converting from nu
-
Music does not play during the slideshow I've created using iPhoto 6.0.4 on the MacBook, although it works fine on the iMac running iPhoto 6.0. Running alone, iTunes works fine, so the problem isn't with the speakers. Any thoughts on fixing this woul
-
new to all of this. I "inserted" the link and then copy and pasted the 'content.xml' page. I am having problems with editing photos. They seem to be locked? thanks kim http://www.artisteontheside.com
-
Is it a bug in BatchSQLException
hi, We are facing problem with our application and it seems to me that BatchSQLException is having some issue. My application is processing around one lakhs of record and for almost half of the record we have BatchSQLException exception. Buffer size