Eagletalon 34 Junior Poster in Training

"myfile>>file;" <- your coding

but I don't see "file" anywhere else? what is "file"?

As Walt says, show us your errors, Copy Paste = your friend

Eagletalon 34 Junior Poster in Training

Think of a function as a building,

You can walk down the hall all the way, and when you get to a room the door/walls etc belong to that room, (room = loop, if, case, etc)

You cant access the door from the next or the previous room in the room you currently are (now don't get technical and create doors from 1 room to the other :P, this example there is only a hallway and the rooms branch from that) ;)

Eagletalon 34 Junior Poster in Training

This is going over my head :(

I have never created a single application with CLR activated, as I mentioned before, it breaks my applications

My environmental variables contain both "C:\Qt\4.5.2\bin;" and

"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;
C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\"

variables

I use a commercial QT full installation that mixes will for our windows applications and is also nice to use with Linux as some of the other developers are working on quite a few linux apps

Eagletalon 34 Junior Poster in Training

Ok whow,

I dont even build my application initially with Visual Studio,

I create a folder, get my source files and header files (made seperately in VS2010) and create a .pro file... which I run the "qmake" command on...

This creates a .vcproj file comprizing all the source & header files I specified in the .pro file, which I then open and just hit 'F7' to get the sollution and other files,

Thus my .dll is not in the Visual Studio folder at all nor my QT libraries (separate installation)

this was achieved by installing QT and adding it to environmental variables, mixing it with windows in a sense

Eagletalon 34 Junior Poster in Training

QT version 4.5.2 and my coding solution in built using qmake command through command prompt

Dunno if that makes a difference at all...

Eagletalon 34 Junior Poster in Training

Is that a forward reference?
If so, it's missing a return type.

If it is a line of code, it's missing the actual parameters.

Seems like a declaration taking place in the header file which still needs to be assigned the reference variable...

Under normal circumstances never give a problem, attached screenshot

Eagletalon 34 Junior Poster in Training

Ok first line looks like this:

Coding:

QVector(int size, const T &t);

Error:
"1>c:\qt\4.5.2\include\qtcore\../../src/corelib/tools/qvector.h(112) : error C2182: 't' : illegal use of type 'void'"

I do need to point out that I am NOT able to have EHs set to "Yes"... that clashes with CLR and gives me the error mentioned before

When I turn Ehs OFF I get these errors as I just mentioned here ^

Eagletalon 34 Junior Poster in Training

I understand.
CLR is a requirement if that is a dot net assembly.

When I have had problems mixing different types of libraries, I have found the biggest problem was the character set.

I have found the MultiByte character set switch solves that.

If you switch to MultiByte and are still having problems, we will need to tackle them as they appear.

Alright can you please just guide me on setting that up,

I do the following, set the CLR (attached screenshot)

-> get error because /clr clashes with /ehs

Disable/Change the C++ exceptions (attached screenshot)

-> get 208 errors & 194 warnings... bit unproductive I think :?

Eagletalon 34 Junior Poster in Training

Do you have the /clr switch turned on?
It doesn't look like you're compiling this for dot net.

Please see my 5th post in this thread, I state that I attempted to enable the CLR but could not manage as it was clashing HEAVILY with the QT coding

Eagletalon 34 Junior Poster in Training

Haha ok got it thnx, anyway, gave that a try, no dice...

Errors:
"1>.\Source\Satelite.cpp(6) : error C2653: 'Interop' : is not a class or namespace name"
"1>.\Source\Satelite.cpp(6) : error C2871: 'Encore' : a namespace with this name does not exist"

The boss man thinks this is becoming a waste of time but my curiosity has been spiked,

any additional assistance would be greatly appreciated

Eagletalon 34 Junior Poster in Training

What problem are you experiencing? Conversion error? data truncation? output? what is going on?

Eagletalon 34 Junior Poster in Training

Does your computer have access to the SQL Server? (Only applicable if SQL Server is located on a separate machine or server)

Is the login information correct? (username and password)

are you using an alias for the SQL Server? (Instead of <servername> using "SQL Server" which is set up as alias under named pipes for <servername>)

If you have more detail of the problem or what you have checked/changed we might be able to help more

Eagletalon 34 Junior Poster in Training

@MrNo - What the h... dude? Walt is actually giving you assistance with your code, NOT writing it for you, and encouraging you to develop your understanding and knowledge your damn self

Stop being a complete ass and learn a thing or 2, your comment you state you've only been learning this on the side for a while? so LEARN!!! dont mope and insult people encouraging that...

This forum is actually a set of decent people helping each other and you attitude is simply going to make LOADS of people ignore you and not offer any assistance any more...

WaltP commented: Thanks.... +17
Eagletalon 34 Junior Poster in Training

Interop.Encore.dll used for communicating with Syspro ERP system's business objects

I have a screen shot but no idea how to attach it, can you give me a tip please?

(In the mean time I sent you an email, hope you dont mind)

Eagletalon 34 Junior Poster in Training

1>.\Source\Satelite.cpp(6) : error C2871: 'Encore' : a namespace with this name does not exist

No dice :(

Eagletalon 34 Junior Poster in Training

I think I got a little further:

I managed to import the reference to it after changing the "Additional Library Directories" setting under Linker in C/C++

Now I have the reference imported to my solution, but what do I need to call to get access to its functions in my class?

In VB the code would be:

Imports Encore

what do I need to include in C++?

Eagletalon 34 Junior Poster in Training

Following Mike's advise I got my program to compile using the information located on the following website:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms686944(v=vs.85).aspx

I do however not know how to access the classes and methods in the library using this, and even if that is necessary,

P.S. I appreciate all the help guys

Eagletalon 34 Junior Poster in Training

Enabling /clr I got the following error:

"1>cl : Command line error D8016 : '/EHs' and '/clr' command-line options are incompatible"

After turning off /EHs (C++ Exceptions) I get LOADS of error and warning methods pretaining to QT:

Warning:

static Category QT_FASTCALL category(uint ucs4);

"1>c:\qt\4.5.2\include\qtcore\../../src/corelib/tools/qchar.h(301) : warning C4561: '__fastcall' incompatible with the '/clr' option: converting to '__stdcall'"

Error:

QVector(int size, const T &t);

"1>c:\qt\4.5.2\include\qtcore\../../src/corelib/tools/qvector.h(112) : error C2182: 't' : illegal use of type 'void'"

Looks like a nightmare

Eagletalon 34 Junior Poster in Training

Not as far as I am aware, it is a completely external library used for the SysPro ERP system, I attempted to add as reference but failed miserably,

I am however able to add it as a reference in VB.NET and access the functions and classes perfectly so I cannot with certainty say that it is not

Eagletalon 34 Junior Poster in Training

Hi there guys, ok I finally got back to the subject of code while we are re-working the structure (finally)

So I have been looking into the WINAPI LoadLibrary functionality mike mentioned and it looks like it will be ideal, however I have never worked with WINAPI, this might be a REALLY beginner question but how do I include the WINAPI functionality?

Doing some searches I found references to "#include "windows.h"... I found a file "marshal_windows.h" in my visual studio include folder but I am completely lost and I request someone to PLEASE hand me a flashlight here :)

Thanks in advance

Eagletalon 34 Junior Poster in Training

Alright first things first... I see this is your first post... so

We are NOT going to give you the entire program, then you learn nothing, trying and getting some code going and asking for help with syntax, errors or middle snippets we will do any time

Ok so first problem, identify the sequence... what us different between character 1, character 2, and character 3... if you find the difference write a loop that takes a digit, adds that digit until you meet the top value (100)

The same goes for problem 2 but it is just the fibonaci seq, check google

Eagletalon 34 Junior Poster in Training

adapt the program above that allows the input of the nominator and denominator of a "top have" fraction and outputs the fraction inthe simplest form.this is done by dividing both values by their gcd. this output is carried out in a function called simplify.

Dude I dont know if your messing or serious but I just know I like :P

Eagletalon 34 Junior Poster in Training

Look what Walt is trying to say is:

char rank;

 

	for (int i=0; i<numFaculty; i++)

    switch(rank)

^
this code makes no sense whatsoever... you are creating a new variable "rank" then you are checking its value,

but is has not been assigned any value? the case will never find what you are looking for

We have no idea what you are checking for so we cant tell you what to do with it or how to do it, and to be honest even if we did we aren't going to give you all the answers on a silver platter

but you need to fill a variable before you check it otherwise it is completely useless?


It would seem as though you dont have a clearly defined plan of your program, its flow or variables, and planning it out like Walt suggested will give you a much better idea of what is going on

Eagletalon 34 Junior Poster in Training

Check the poster user name... quite fitting no? Homework assignment?

Eagletalon 34 Junior Poster in Training

Problem?

Eagletalon 34 Junior Poster in Training

Alright... that errors are NOT really errors in your syntax of that line... a Linker Error means there is a problem with a method...

most of the time it is that a method is declared in the header and not used in the source...

So first step... make sure both ends of "'WSAStartup@8'" exist... derived from "[Linker error] undefined reference to `WSAStartup@8'"

Eagletalon 34 Junior Poster in Training

This website REALLY helped me, registration is free and it covers most field as well as some questions http://www.cprogramming.com/tutorial.html

Eagletalon 34 Junior Poster in Training

Hi There

I agree with Walt 100% and I would just like to add the following:

Read your assignment very clearly and Identify the requirements,

1 thing I see is that your assignment requires you to create the 2-dimensional array in your main()... I'll leave the rest

1 other thing, and this is not a requirement at all, but I found it helps me a lot to add as many as possible comments to my code to not only explain it to others when I need help, but to enable me to read the flow of my program easier,

That way proper formatting becomes evident,

Eagletalon 34 Junior Poster in Training

using the same logic it might mean that you need to load the "lineData" variable into a char* as well and change the string in the same way... it MIGHT work... wont hurt to try I guess?

Eagletalon 34 Junior Poster in Training

Something tells me the problem comes in with the first error (ie when you solve that it might take the others away as it seems to be a chain taking place in the order they reference each other)

I do not carry much knowledge on "std::basic_istream<char, std::char_traits<char>>" type coding as I use external variables for my programs, however that second error I would know anyplace

What it is telling you is that you are trying to use a char variable where a pointer to a char variable is expected

in other words if you create something like the following it should solve that:

char* sString = new char();
sString = 's';
strtok(string1, sString);//strtok(string1, 's');
Eagletalon 34 Junior Poster in Training

http://stackoverflow.com/questions/4060601/make-sounds-beep-with-c

Running windows makes it rather easy with the Beep() function (just check the parameters in the link)

Please just ensure that you have a working speaker installed on you motherboard or it will definitely not have the desired result :)

Eagletalon 34 Junior Poster in Training

Look at it this way...

X is a variable right... P is a pointer that points at X (p = &x)... * means pointer and & means reference (http://www.cprogramming.com/tutorial/lesson6.html)

now think of P as kind of a portal to access X... anything you enter into P actually gets set in X, and setting X also changes P because its like looking through a portal at the same thing...

When sending variables to a function, it is much better to send a pointer or a reference because you can then in the function change the value of the variable and when you get back to the previous method the value is still changed... This is also VERY resource effecient

alternatively sending a variable without a pointer or reference indication creates a second variable with the same value and uses more resources

Coding Example:

void MyClass::ParentMethod(){

    int var = 0;
    
    changeVar(*var);

    cout<<var<<endl; //outputs "4"
}

void MyClass::changeVar(int& var){

    var = 4;

}
Eagletalon 34 Junior Poster in Training

Well theoretically if you say "pointer = new class()" and you allocate memory to it then yes you would have to...

the core programming stays C++, only C# users are blessed with the garbage collecter

Eagletalon 34 Junior Poster in Training

What I usually do is I inherit my main class from the UI, that way I can run the functions as follows:

setupUi(this);

QString text;

text = this->lineEdit->text();

the whole thing with the "ui->member->function" is to be able to handle multiple forms better, that way you need to specify the parent of the widget to access the correct one...

its like working in a database in SQL, you can either use "SELECT * FROM MyTable" or you can use "SELECT * FROM MyDatabase.dbo.MyTable"...

Eagletalon 34 Junior Poster in Training

I believe the issue is that the controls you have added to the ui are not named in the same way in the ui's header file... you can try to rename them manually if you cant recompile the header

And I am sorry to ask this, but are you certain you changed the name in the correct field? QT Designer has 2 fields namely "Object Name" and "Text"...

Eagletalon 34 Junior Poster in Training

Basically what QDialogButtonBox::Ok is is a static member of the QDialogButtonBox class defined in the QT libraries... another example is the QMessageBox... please see usage below:

QMessageBox::information(0, "Title bar text", "Message text", "", "")

This will give you basic message box (with information image, can also use critical for errors etc) and update a user on a successful run where there is no other output...

A QDialogButtonBox is where you want to have the user give feedback ("Proceed?")

If you have QT Designer you should also have QT Assistant... you should be able to see the syntax and alternatives there

Eagletalon 34 Junior Poster in Training

Ey mate... I use QT myself... how do you compile your program into a VCproject?

I personally use qmake command in command prompt, if this is how you do it as well just run it again with the application closed and it should update all the ui changes into your project

Eagletalon 34 Junior Poster in Training

also just want to point out a spelling mistake that could give you a headache: "&& HitteeBox.Left <= HitteeBox.Right)"

Eagletalon 34 Junior Poster in Training

What WaltP is trying to slow walk you to is dividing the amount by 16 (hexa),

how hexadecimal works is that you take the decimal amount, divide it by 16, take the fraction (after the decimal point) and multiply this by 16, then take the integer remainder (before the decimal point) and repeat the process until the dividing results in a value smaller than 1,

then you take the hexadecimal values (found by the multiplication) and turn it back to front...

this process can be found here www.permadi.com/tutorial/numDecToHex/

I wont give you the coding, sorry mate but you'll have to work for it, but I think this will give you what you need if you want to solve it yourself...

thus: 405678
step 1:

405678 / 16 = 25354.875.. take 0.875

25354 / 16 = 1584.625... take 0.625

1584 / 16 = 99.0... take 0.0

99 / 16 = 6.1875... take 0.1875

6 / 16 = 0.375... take 0.375

step two:

0.875 * 16 = 14 = E

0.625 * 16 = 10 = A

0 * 16 = 0 = 0

0.1875 * 16 = 3 = 3

0.375 * 16 = 6


Step three:EA036 -> 630AE


Hex value = 630AE

HINT: Step 1 and 2 can take place within a single loop

Eagletalon 34 Junior Poster in Training

Hey mate... change your Subquery (in the select statements)... take away the joing and everything...

SELECT T0.ItemCode, T0.Quantity, SUM(T0.Quantity)

FROM RDN1 T0 

WHERE T0.ItemCode IN (SELECT T0.U_ItemCode  FROM MET_OBOM  T0 INNER JOIN MET_BOM1  T1 ON T0.DocEntry = T1.DocEntry WHERE T1.U_ItemCode = '30-05-618XD') 

ORDER BY T0.DocEntry ASC

See how that treats you

If not... try this:

SELECT T0.ItemCode, T0.Quantity, (SELECT SUM(T1.Quantity) FROM RDN1 T1 

WHERE T1.ItemCode IN (SELECT T0.U_ItemCode  FROM MET_OBOM  T0 INNER JOIN MET_BOM1  T1 ON T0.DocEntry = T1.DocEntry WHERE T1.U_ItemCode = '30-05-618XD') 

ORDER BY T0.DocEntry ASC)

FROM RDN1 T0 

WHERE T0.ItemCode IN (SELECT T0.U_ItemCode  FROM MET_OBOM  T0 INNER JOIN MET_BOM1  T1 ON T0.DocEntry = T1.DocEntry WHERE T1.U_ItemCode = '30-05-618XD') 

ORDER BY T0.DocEntry ASC
Eagletalon 34 Junior Poster in Training

Nevermind cant get the spacing right

Eagletalon 34 Junior Poster in Training

Hey guys,

Alright I have a tricky assignment to do in a view that will enable my next program to run MUCH faster and more reliable...

Now I need to list all Items (1 table) and their locations where they are stored (2nd table) in a way that enables 1 to transfer...

Problem is the second table does not contain all the necessary locations as the previous programs would delete a location entry once it hit 0...

So how do I do the following:

Table1:
<PRE>
Item ID
1. X
2. Y
</PRE>
Table 2:
Item ID Location Quantity
X A 5
Y B 3


Desired View:

Item ID Location Quantity
X A 5
X B 0
Y A 0
Y B 3


I realize that simply asking a solution without trying is not the aim of this forum... but I'm really at my wits end and I've tried all kinds of join Statements I know,

I dont think it will be too difficult, but I am just missing something

Would really appreciate a quick solution, thnx guys

Eagletalon 34 Junior Poster in Training

Just a quick question on the check for character case... would this not also be an acceptable check?

#include <cctype>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <istream>
#include <iostream>
#include <string>

using namespace std;

int main(){

	string ch = "";
	string ch2 = "";
	string uppercase = "";

	cout << "Insert String\n";
	cin>>ch;
	cin.ignore();

	ch2 = ch;
	transform(ch2.begin(), ch2.end(), ch2.begin(), toupper);

	if (ch == ch2){

		cout << "upper case " << ch << " \n";
	}
	else{

		cout << "lower case " << ch << " \n";
	}
	cin.get();

    return 0;
}

I tested it in practice and it worked... can be adapted to check a set amount of characters in a string etc... just want a second opinion on its use?

Eagletalon 34 Junior Poster in Training

Awesome mate :) just mark the thread as solved please?

Eagletalon 34 Junior Poster in Training

Did you just comment on your own post? :S... riiiight...

Anyway how about just creating a timer that repeats and emits a signal that will cause all bluetooth devices to be searched... and when one is returned that was not there before you emit a signal that would start the slot event for in range and the same when one isnt there that used to be?

Eagletalon 34 Junior Poster in Training

Would the values change at all? otherwise you load on the values and check it initially... and upon a new entry you could add that one in (if it is not yet contained) then there is no need to handle ALL of them EVERY time?

Eagletalon 34 Junior Poster in Training

Just a shot in the dark... but how about saving the keys in a List... and then removing the duplicates... and running the list through a count?

Eagletalon 34 Junior Poster in Training

Because you are working in the source code of the class "masterList"...

the only way "masterList" would be able to access the functions of "groundArray" is by creating an instance of it (groundArray * ground = new groundArray())

and then calling its methods as follows: ground->getlistX(i)

another way would be to inherit "masterList" from "groundArray"

Eagletalon 34 Junior Poster in Training

I have managed to retrieve a list of all files contained in a folder (and all sub folders) but unfortunately this is relying heavily on and written using QT libraries... if you would like I could post said code

Eagletalon 34 Junior Poster in Training

Aren't you forgetting something? The arrows maybe?

Don't be greedy mate... these answers don't deserve reputation change...