|
Hi
I have gotten this error from time to time but have always gotten around by doing a build or rebuild
this time I even tried a clean nothing helps
Just wondering is the source stored in the PDB file
|
|
|
|
|
No but the debug information is. If the debugger cannot match the source line with the information in the PDB then it will put this message. Check that you do not have links to out of date files in the project anywhere. Alternatively make sure that there is not a file included somewhere that is not getting rebuilt.
|
|
|
|
|
Richard
I tried for the life of me to figure out why is wasn't being rebuilt I ended up using the option allow source to be different
thanks
|
|
|
|
|
I entered the unit testing world about a year ago and now my team and I start working with Linux.
Which mocking framework do you think is the best for Linux and why?
Thanks!
|
|
|
|
|
Welcome to codeproject.
I don't know.
Here's a Software Test joke instead of an answer:
A senior software tester and a entry level tester went into the company cafeteria and sat down. The senior employee removed a tuna sandwich from an old brown bag. The entry level tester promptly removed a ham sandwich from his man-purse.
Then a security guard noticed that these employees were breaking the rules and quickly came over to the table. "The company rules clearly state that you cannot bring your own lunch to the cafeteria!" the guard exclaimed.
The senior tester looked at the security guard, then shrugged his shoulders and exchanged sandwiches with the entry level tester. "I found a loophole in the company rule." he commented with his mouth full.
Maybe someone with more test experience will answer your question. You might get greater visibility by posting your question in the 'Quick Answers' section.
Best Wishes,
-David Delaune
|
|
|
|
|
All my code is C so unity, ceedling and cmock and it's irrelevent if it's linux, windows or embedded code. At the end of the day you are testing the code not the compiler implementation and optimizations of the code.
There is a pretty good background to it all at
Throwtheswitch.org[^]
There are also forums there if you need to ask questions.
In vino veritas
modified 29-Apr-18 23:18pm.
|
|
|
|
|
The company I work for started using Isolator++ for Linux and it seems to work so far pretty well
|
|
|
|
|
Nice! What are their mocking abilities?
|
|
|
|
|
you can mock and fake almost everything, any kind of
methods,
fields,
behaviors,
interfaces,
dependencies,
Instances, and more.
|
|
|
|
|
|
I have this code, which works on CodeBlocks, but when I try to run it in visual studio code, I get and error saying:
invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char, char_traits<char> >') and 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >'))
this is the code:
#include <iostream>
using namespace std;
class field{
public:
void Create_Area(int area){
string field[area][area];
for(int y = 0; y < area; y++){
for(int x = 0; x < area; x++){
field[y][x] = "+ ";
cout << field[y][x];
}
cout << endl;
}
}
};
What to do to fix this?
|
|
|
|
|
You cannot create an array on the stack using values that are not known at compile time. You need to change your code to:
void Create_Area(int area){
string field[][] = new string[area][area];
Also, I would suggest not using the class name for an array in that way. And the field variable is not available outside of the method that creates it.
|
|
|
|
|
I have changed that, but now how do I use it in this part?
Field[y][x] = "+ ";
cout << Field[y][x];
also, I don't really understand what you have done in the new string[area][area] part. Why use string instead of field?
|
|
|
|
|
Member 13802912 wrote: how do I use it in this part? Exactly the same as before.
Member 13802912 wrote: the new string[area][area] part. Why use string instead of field? Because you are trying to create an array of string objects. See new Operator (C++)[^].
|
|
|
|
|
fatal error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char>') and 'void')
this is the error i am getting.What should i do?
#include <iostream>
void Find(int arr[], int n, int sum)
{
unordered_set<int> s;
int temp;
for (int i = 0; i < n; i++)
{
temp = sum - arr[i];
if (s.find(temp) != s.end())
cout<< arr[i]<<"+"<< temp<<" ";
s.insert(arr[i]);
}
}
int main()
{
int arr[] = {1,2,3,4,5,6,6,5,56,7,11,13} ;
int n = sizeof(arr)/sizeof(arr[0]);
int sum = 12;
cout<<Find(arr,n,sum);
return 0;
}
|
|
|
|
|
You have declared:
void Find(int arr[], int n, int sum)
cout<<Find(arr,n,sum);
But you cannot print something that is void , i.e something that does not exist.
|
|
|
|
|
So what should i do
Instead of void i used
int Find()
{....
return 0;
}
But at the end of my input extra zero is coming which i dont want.
Thank you!
|
|
|
|
|
Then don't return a value. Leave it as void and remove the cout call at the end of your main method.
BTW in future please open a new question if you have a problem, rather than reopening a thread that is over two years old.
|
|
|
|
|
I hope that someone can help me.
I am currently working on developing a flight simulator with force feedback. To do the calculations of the force feedback, we need to know the position of vertical yoke that we are using. We use two potentiometers to detect the position of the yoke for roll and pitch. The potentiometers are connected with Arduino Uno that will change analog values to digital values:
Digital value of roll will be between [450: 650]
Digital value of pitch will be between [100: 340]
These values then will be sent to Raspberry Pi where we do the calculations of force feedback. I’m using the RS232 protocol (library developed by Teunis van Beelen [link]) to receive the data from Arduino.I'm using a usb cable to send data from Arduino To RPi.
I’m developing the code in Qt Creator in C++
My problem: I received the data packets from Arduino every 10ms, BUT, sometimes the packets are cut into two parts (see figure 1). I can say that for every 100 data packets sent, 6 will be cut. So I will receive 6 times incomplete data packets for the calculations. The "incomplete part" will come together with the next data packet.
For the time being, if the data was cut, the code will just "jump" the data packet and will not do any calculation. But, for optimisation purpose, I need to resolve this problem. By the way, the baudrate is the same for Arduino and RPi that is 115200. The whole program is being developed in C++, so it is not advisable to use pyserial because the program need to receive and calculate the force feedback within 10ms.
[figure1]
Can someone explains why and how did these happen? What do I need to do to resolve this problem?
My code in Arduino
int pinpotRoulis=A0; int valpotRoulis=0;
int valmancheRoulis=0;
int mapRoulis =0;
int pinpotTangage=A5; int valpotTangage=0;
int valmancheTangage=0;
int mapTangage =0;
int voltage = 8;
void setup() {
Serial.begin(115200);
pinMode(voltage,OUTPUT);
digitalWrite(voltage,HIGH);
}
void loop() {
char dataToSend[20];
valpotRoulis = analogRead(pinpotRoulis);
valpotTangage = analogRead(pinpotTangage);
sprintf(dataToSend, "R%dE T%dE", valpotRoulis, valpotTangage);
Serial.println(dataToSend);
printf("%s\n", dataToSend);
delay(10);
}
My code in QtCreator in RPi :
void MainWindow::getPotentiometreFFB(){
do{
n = RS232_PollComport(cport_nr, (unsigned char *) str_recv, (int)BUF_SIZE);
i++;
}while(n <= 0 && i < 1000000);
if(n > 0){
str_recv[n] = 0;
printf("Received %i bytes: '%s'\n", n, str_recv);
position = -1;
for (int j = 0; j < n ; j++)
{
if(str_recv[j]=='R') {
position = j;
break;
}
position = -1;
}
if (position != -1) {
for (int k = 0;k<5;k++)
{
valeur_R[k] = str_recv[position+k];
}
char * ptrsuite_1Chaine = NULL;
ptrsuite_1Chaine = strchr(valeur_R, 'E');
if (ptrsuite_1Chaine != NULL)
{
sscanf(valeur_R,"R%dE",&valRoulis);
valRoulis = minMaxPotentiometre(450, 650, valRoulis);
m_data.roll_cmd = mappingPotentiometreRoulis(valRoulis);
}
}
position = -1;
for (int j = 0; j < n ; j++)
{
if(str_recv[j]=='T') {
position = j;
break;
}
position = -1;
}
if (position != -1) {
for (int k = 0;k<5;k++)
{
valeur_T[k] = str_recv[position+k];
}
char * ptrsuite_2Chaine = NULL;
ptrsuite_2Chaine = strchr(valeur_T, 'E');
if (ptrsuite_2Chaine != NULL)
{
sscanf(valeur_T,"T%dE",&valTangage);
valTangage = minMaxPotentiometre(100, 340, valTangage);
m_data.pitch_cmd = -mappingPotentiometreTangage(valTangage);
}
}
cout<< "Val roulis :" << m_data.roll_cmd << endl;
cout<< "Val tangage :" << m_data.pitch_cmd << endl;
ui->roll_cmd->setValue(m_data.roll_cmd);
ui->pitch_cmd->setValue(m_data.pitch_cmd);
}else{
cout << "No data Roulis tangage" << endl;
}
}
Feel free to ask if you guys need more info from me.
Thank you very much
|
|
|
|
|
The answer is obvious:
You have to rewrite your code to be able to handle incomplete packages.
You got incomplete packets because you stop receiving if any number of data has been received (even a single byte/character). That would be the normal behaviour. The only reason why that happens not very often is that the system has to service also other tasks. And that is not done while waiting (see end of my post)!
Because you are sending only a single kind of data, you can change the data being send using a fixed length format by using leading zeroes:
sprintf(dataToSend, "R%03dE T%03dE", valpotRoulis, valpotTangage); That makes parsing much simpler (e.g. using scanf() ) and you can wait for the known number of characters (11 + line feed):
const int CMD_LENGTH = 12;
while(n < CMD_LENGTH && i < 1000000); By the way: what is the purpose of the undefined variable i here?
But when doing so you will run more into the already existing performance problem of using a polling loop. Waiting for the data wastes a lot of time (10 ms) that is not available for other tasks.
The solution is to put the receiving into an own thread and use the fine Qt signaling features. Because there are only two event data values, there is even no need to use shared variables.
|
|
|
|
|
Jochen Arndt wrote: That makes parsing much simpler (e.g. using scanf() ) and you can wait for the known number of characters (11 + line feed):
const int CMD_LENGTH = 12;
while(n < CMD_LENGTH && i < 1000000); By the way: what is the purpose of the undefined variable i here?
I don't really understand what you are doing here? Can you please explain it a bit more and detailed? And where do i need to put this code, is it after I received the data from Arduino (after printf to see how many data in the string?). By the way, i just started coding two months ago. I'm sorry if I asked a lot of questions.
do{
n = RS232_PollComport(cport_nr, (unsigned char *) str_recv, (int)BUF_SIZE);
i++;
}while(n <= 0 && i < 1000000);
if(n > 0){
str_recv[n] = 0;
printf("Received %i bytes: '%s'\n", n, str_recv);
Jochen Arndt wrote: But when doing so you will run more into the already existing performance problem of using a polling loop. Waiting for the data wastes a lot of time (10 ms) that is not available for other tasks.
The solution is to put the receiving into an own thread and use the fine Qt signaling features. Because there are only two event data values, there is even no need to use shared variables.
Like you said, I would prefer to not use polling because the program needs to be really dynamic(10 ms).
When you said "put the receiving into an own thread", do you mean put the received data in another string?
I don't really know about the Qt signaling features. I just took a hold in this project two months ago and just started doing Qt 2 weeks ago. Would you give me a link that would help me to understand the features and why and how to use them?
Tqvm
|
|
|
|
|
When you send data with the format "R%03dE T%03dE" it will be of fixed length like in "R450E T030E". The length is 11 characters plus the the line termination appended Serial.println() . Assuming that it appends a single LF and not a CR-LF pair, the length will be 12 bytes.
Knowing that you can implement reading until all bytes of a package has been received (untested from scratch):
const int packetLength = 12;
int packetRead = 0;
while (packetRead < packetLength)
{
int read = RS232_PollComport(cport_nr, (unsigned char *)str_recv + packetRead, (int)BUF_SIZE - packetRead);
if (read < 0)
{
return;
}
packetRead += read;
}
str_recv[packetRead - 1] = 0;
char cmd1, cmd2;
int val1, val2
sscanf(str_recv, "%c%03dE %c%03dE", &cmd1, &val1, &cmd2, &val2);
if ('R' == cmd1)
position = val1;
else
position = -1;
An application can be splitted into multiple threads. You typically have the main thread that is doing the user interaction and screen outout (often also called GUI thread) and background threads that perform asnychronous operations like networking or serial communication as in your case.
If you execute such polling operations (or calling sleep() ) within the main thread that will be blocked for long times resulting in lags and stuttering screen update. Note also the error check in the above code. Without that your application would stuck forever when the serial connection is interrupted by unplugging the cable or switching the Arduino off.
The solution is to create a worker thread that receives the data and uses events to signal the main (GUI) thread when new data has been received. The main thread then handles the event and can update the screen with the new data.
However, using threads is an advance programming topic so you might proceed with the polling for testing the communication. But sooner or later you would have to use threads. The thread itself can be implemented as pthread or QThread Class | Qt Core 5.10[^]. Inside the worker thread use a QEvent Class | Qt Core 5.10[^] to signal new data to the main thread.
In any case read the Qt documentation for the used functions which includes example code. You might also search the web for additional information. The Terminal Example | Qt Serial Port 5.10[^] and Blocking Slave Example | Qt Serial Port 5.10[^] might be for example of interest.
|
|
|
|
|
This is a common issue with communication lines. When you read the incoming data you cannot assume that every message will contain everything that was sent from the other end. You need to read however many bytes are presented in a loop, and build the message as you go. How you check for a complete message depends on the protocol you are using.
|
|
|
|
|
The problem is simple Serial.println won't necessarily clear the buffer in your small 10ms delay.
There is a guaranteed Line Feed character "\n" on the output with this line
Serial.println(dataToSend);
So you have a guaranteed packet end marker. On that poll routine you could simply also insert a timeout error handler.
However the only basic requirement is the read poll loops keeping all characters it see's before a LF character.
At the moment your crazy reading poll runs around a million times instead of just looking for the LF character
In vino veritas
modified 25-Apr-18 23:58pm.
|
|
|
|
|
This is a Linux question, hope it is OK to ask here.
I am asking here since I am getting no response from original article author nor Linux forum.
I am "discovering" variety of Linux ways to interface with the world.
I do not particularly want to call these ways "modules".
I am into using "ioctl" and having some success coding "dev" individually.
Each "dev" has decent Linux documentation which I am using.
The real question - how does "dev" framebuffer gets to output to "dev" SPI?
I need some general comments , not particularity code samples.
Appreciate any help, but if Linux questions are not appropriate here , just ignore me.
Cheers.
|
|
|
|
|