Duki 552 Nearly a Posting Virtuoso

Hey guys,

I'm trying to run this code

// Copyright (C) 2001-2003
// William E. Kempf
//
//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <boost/thread/thread.hpp>
#include <iostream>

void helloworld()
{
    std::cout << "Hello World!" << std::endl;
}

int main()
{
    boost::thread thrd(&helloworld);
    thrd.join();
}

but I keep getting this error

1>main.obj : error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x01000018).

I'm using Windows 7 Pro and VS2008. Any clues on this?

Duki 552 Nearly a Posting Virtuoso

Thanks for the advice - I'll try changing them from #include ".." to <...>. Also, I've setup a few different directories in my project properties include paths - I'm not including the path in my #include

e.g.

#include "JrLogger.h"
Duki 552 Nearly a Posting Virtuoso

modified my previous post quite a bit - may want to look over it again.

Duki 552 Nearly a Posting Virtuoso

Try putting a WHILE{} inside your ELSE{} - Maybe this will solve your problem? Something along the lines of

if (...)
{
   ....
}
else
{
     while (a != Enter || ENTER || enter)
     {
         ....
         
         cout << "type enter to exit loop" << endl ;
         cin >> a ;
     }
}
}
Duki 552 Nearly a Posting Virtuoso

Your array for month/day/year is too small - should be dzim[3] don't you think? Also, I'm a little confused - why are you asking for a birth date and then doing a random date later in the program?

Duki 552 Nearly a Posting Virtuoso

What are you stuck on? It looks like you've given up for the most part - I don't see a function definition for trans.left() or trans.down(). Also, where are you cin >> statements to bring in the data?

Duki 552 Nearly a Posting Virtuoso

My build log - not sure that this helps.

Build Log


Build started: Project: jaus_v2, Configuration: Debug|Win32

Command Lines


Creating temporary file "c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\jaus_v2\jaus_v2\Debug\RSP00000149084768.rsp" with contents
[
/Od /I "C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\jaus_v2\jaus_v2\jr" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /ZI /TP ".\jr\src\XmlConfig.cpp"

".\jr\src\TCPConnection.cpp"

".\jr\examples\C++\sender.cpp"

".\jr\src\JuniorRTE.cpp"

".\jr\src\JuniorMgr.cpp"

".\jr\src\JuniorAPI.cpp"

".\jr\src\JUDPTransport.cpp"

".\jr\src\JTCPTransport.cpp"

".\jr\src\JSerial.cpp"

".\jr\src\JrSockets.cpp"

".\jr\src\JrLogger.cpp"
]
Creating command line "cl.exe @"c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\jaus_v2\jaus_v2\Debug\RSP00000149084768.rsp" /nologo /errorReport:prompt"

Output Window


Compiling...
JrLogger.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\jrlogger.cpp(27) : fatal error C1083: Cannot open include file: 'JrLogger.h': No such file or directory
JrSockets.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\jrsockets.h(29) : fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory
JSerial.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\jserial.h(29) : fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory
JTCPTransport.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\jtcptransport.h(29) : fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory
JUDPTransport.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\judptransport.h(29) : fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory
JuniorAPI.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\juniorapi.cpp(26) : fatal error C1083: Cannot open include file: 'JuniorAPI.h': No such file or directory
JuniorMgr.cpp
c:\documents and settings\administrator\my documents\visual studio 2008\projects\jaus_v2\jaus_v2\jr\src\juniormgr.h(26) : fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory

Duki 552 Nearly a Posting Virtuoso

Are they in your include path?
On some platforms, the file names are case-sensitive. Do you have the capitalization and/or spelling correct?
Are the #includes in a conditional compilation block that isn't compiling under your current configuration?
Are they #included by a header that you have forgotten to #include in your main source file?

Yes
Yes
No
No

:(

Duki 552 Nearly a Posting Virtuoso

Hey guys,

i have this project that, when i compile, 11 of the header files cannot be opened. I have no clue why - i've never seen this type of error. The project is much to large to copy/paste here, but does anyone have an idea of what would cause this? They header files are not opened by anything else.

Duki 552 Nearly a Posting Virtuoso

Hey Guys,

I have a header file I downloaded for an application (actually about 20 header files). Most of them can be opened fine, but I get errors on a couple that say:

fatal error C1083: Cannot open include file: 'Transport.h': No such file or directory

I've checked, and the file is a header file in my project. Anyone have any ideas?

Thanks

Duki 552 Nearly a Posting Virtuoso

I tried adding the path under Project->properties->references, but to no avail.

Duki 552 Nearly a Posting Virtuoso

I will be using the .lib that came with the .dll

Duki 552 Nearly a Posting Virtuoso

Does anyone know how to add custom .dll and .h files to projects in Visual C++ 2008?

Duki 552 Nearly a Posting Virtuoso

Hi everyone,

In this page: http://www.pentree.com/contact/list
The coloring for our logo is off slightly when viewed in FireFox. However, the image looks like it matches in IE. Does anyone know why?

Duki 552 Nearly a Posting Virtuoso

Hey Everyone,

I was just thinking it would be nice to have a forum dedicated to software development using Qt. I know IDE topics aren't really the goal of DaniWeb software development, but with the growing popularity of Qt I think it would be a move in the right direction. Especially since it is platform independent. Just a thought.

Duki 552 Nearly a Posting Virtuoso

Hey guys,

I'm about to start on a research project about multi-threading. I'm very comfortable with c++ oop/data structures concepts, but am completely new to programming with multiple threads. Does anyone have suggested resources for me to get started?

Duki 552 Nearly a Posting Virtuoso

Really wanting a google wave invite... can anyone help me out?

Duki 552 Nearly a Posting Virtuoso

click me

Sky Diploma commented: Hehe!! +9
Duki 552 Nearly a Posting Virtuoso

awesome article. thanks

Duki 552 Nearly a Posting Virtuoso

Great article.

Duki 552 Nearly a Posting Virtuoso

Is there a way to make links in unordered lists be non-underlined by default? And when the user hovers over the link, it becomes underlined?

Here's the current code:

<ul>
<li><a href="water">Water</a></li>
<li><a href="wastewater">Wastewater</a></li>
<li><a href="surveying">Surveying</a></li>
<li><a href="aerial">Aerial</a></li>
<li><a href="it">Technology Consulting</a></li>
</ul>

On the page with the lists, all of the links are underlined by default and the underline goes away when you hover over it. We want the opposite of this.

Duki 552 Nearly a Posting Virtuoso

Our organization has hundreds of project numbers. I would like to create a program that will let me store the numbers along with keywords in a database, and then have the option for predictive searching. By predictive searching I mean something similar to how when you start typing something in Google, it predicts what you might be looking for... that's the best example I can think of.

So if I'm looking for project #555-5555 and the project is titled City of Cisco, I can start typing "City of" and the predictive search will start displaying my entries like "City of Cisco" "City of Laptop" "City of Diversity" etc.

Thanks for any help!

Duki 552 Nearly a Posting Virtuoso

Sorry for the confusion. Let me try to clarify it a little. What I'm trying to do is to get two already written programs to work together. I have one program that gets data from a Laser Measurement System. It reports its values in an array of longs. I need to send these vaules to another program. I have some code that will send a char* via udp ports (using the sendto() function). So I thought that I could convert the each long to something that my code could send to the other program.

I may be doing this completely wrong, so if you know of a better way to do this please let me know. The only reason that I'm doing it this way is because of time constraints and limited knowledge of this type of programming.

Hope this helps

Duki 552 Nearly a Posting Virtuoso

So let me see if I understand this. If I use

template <class T>
std::string to_string(T t, std::ios_base & (*f)(std::ios_base&))
{
  std::ostringstream oss;
  oss << f << t;
  return oss.str();
}

I should be able to pass this function a long and it will convert it to a string.

cout<<to_string<long>(123456, std::string)<<std::endl;
Duki 552 Nearly a Posting Virtuoso

I am trying to convert an array of longs to an array of chars. There are 1081 elements in the long array. Each element is 4 digits long. Is there a function in C++ that will convert a long something I can store in the array or could someone point me in the right direction? I'm not sure how to go about solving this one.

Thanks

Duki 552 Nearly a Posting Virtuoso

So my Data Structures class has finished the book we were using, but we still have a week of school left. My instructor has started going over binary files... only problem is I wasn't there when he went over it.

My assignment is to open a binary file, save the contents to a dynamic array, and output the contents to the screen. I'm getting close (I think) but when I output the array, it's not outputting in clear text. What am I doing wrong?

Here's what I have so far... but I'm really confused right now. This is the accumulation of a lot of copy/paste.

// emprecs.cpp

#include <iostream>
#include <fstream>
using namespace std;
 
const int SIZE = 12;
struct employee {
	char fname[SIZE];
	char lname[SIZE];
	float wage;
	float hours;
	void print() ;
};
 // readTxt() reads the records in input.txt, stores them in ary,
 //  and returns the number of records read
int readTxt(employee ary[]);
 // writeBin() writes the array of employee records to output.bin
void writeBin(employee ary[], int n);

void readFile(employee ray[]);

int main()
{
	employee payroll[SIZE];
	
	int count = readTxt(payroll);  // count = number of records in file
	if ( count > 0 ) {
		writeBin(payroll, count);
	} // endif

	readFile(payroll) ;
	cout << endl;
	cout.write(reinterpret_cast<char *>(payroll), sizeof(employee) * count);

	cout << "\n\n-- Program Complete --\n\n" ;

	return 0;
}

int readTxt(employee ary[])
{
	char temp[SIZE];
	int k = 0;
	ifstream inFil( "input.txt" );

	if ( inFil.is_open() ) {
		while ( !inFil.eof() ) { …
Duki 552 Nearly a Posting Virtuoso

Awesome. The bot is currently Windows based, but we have plans on migrating to Kubuntu eventually... hopefully next year.

Thanks again.

Duki 552 Nearly a Posting Virtuoso

I'm going to be working on a summer research project with my college's robotics team. My task is going to be to develop a program to communicate with the robot via 802.11g.

I would really like to stick to straight C++, and if I can't then C# is also an option I would be willing to go with. My question is, does anyone have a suggestion for a good winsock library I could use for this? Maybe something with tutorials also?

Are there built in libraries that I'm not aware of?
Thanks

Duki 552 Nearly a Posting Virtuoso

Congratulations!

Duki 552 Nearly a Posting Virtuoso

Ah, nice. I'll give that a try. Thanks!

Duki 552 Nearly a Posting Virtuoso

I know the problem sounds a little (understatement maybe) odd.
I understand what you're saying nucleon, and that would seem a lot more logical. However, I'm sure I haven't misunderstood the project. :)

>Narue
This is probably going to make you flip out. But in the case of input such as: 2 ^ 3 ^ 4, the left associativity should be used. In any case with subsequent ^, right associativity should be used (e.g., ^ ^ 2 3 4).

heheh, ^.^;

Duki 552 Nearly a Posting Virtuoso

> You could write an Object Oriented Program (of course :P) that represents a 'virtual computer', you'll have to make classes for the processor, the motherboard, the graphical card, the ports (USB, FireWire, Serial, PS/2, etc.), the CD-Drive(s)...

Oooh I like that one, That sounds fun.

Duki 552 Nearly a Posting Virtuoso

Have you tried:

- Different cable
- Different port on the switch
- Different NIC
- Making sure your IP settings are what you expect
- Making sure no devices have conflicting IP addresses

Do you have DHCP setup on this server? Is the IP of the server static?

Duki 552 Nearly a Posting Virtuoso

Best C++ book I've ever used: C++ Programming: From problem analysis to problem design... by Malik.

Latest Edition

Duki 552 Nearly a Posting Virtuoso

Other forums that I visit for help have this feature, and it seems like it would be very helpful.

Often times, someone will post a thread and because of the number of people online it may start to sink to the bottom without receiving any replies. What I suggest is having a slight background shade to all threads that have 0 replies. This way, when helpers come on the forum to see what questions people have, they can very quickly find the posts that have received 0 replies, and maybe help them out.

Just a thought. :)

Duki 552 Nearly a Posting Virtuoso

One of my favorite projects I worked on was a small RPG type game.

I can't remember it all, but I had classes that were derived from base classes.. these were the fighters. Elvaan, Hume, etc. And each class had different traits... (Elvaan might have attack +10%, Hume might have a +10% chance of blocking, something else might have a +5% chance of attacking twice, etc.). Each race had different starting attributes, attack, strength, magic attack, HP, etc.

Then I put them all into a main() file for the fighting simulation. Each round would start a battle between 2 races. Main() would call the battle() function, which would setup the possibilities and call a random() function multiple times to determine who would attack, how much they would attack for and if anyone had the chance of blocking how often, etc. This would continue to loop, requiring the user hit Enter between every round, until one of the creatures was defeated.

Of coarse it took multiple runs to figure out if I had made one race too powerful or one race not powerful enough, which I then went back and made adjustments to the attributes.

Needless to say, this was an extremely fun exercise. Allows for a ton of creativity. :)

Duki 552 Nearly a Posting Virtuoso

That's stupid. You want to input a a prefix expression but evaluate it differently from the prefix notation rules. Would you be kind enough to explain why you need to do this?

hahah, no kidding.

This is, I guess, considered to be a programming challenge from my professor. The only thing I could think of would be to add a exception-handling block for when two ^ are found... but I have no clue if even that will work.

Honestly, I don't think anyone in the class has this figured out. I might turn in my assignment without this part included, hoping he'll mark it off. Quite silly, I agree.

Duki 552 Nearly a Posting Virtuoso

You're right about the input. However, the input has to stay as ^ ^ 2 3 4. I need a special case maybe, to take care of the double ^?

Duki 552 Nearly a Posting Virtuoso

Hey everyone,

I'm trying to make it so that my ^ operator is right justified within this binary expression tree.

For example, 2^3^4 should be evaluated as 2^(3^4). So I should get 2^81, instead of the usual 2^12.

Here is the code I have so far. Everything works, except the ^ is still left associative. I know this is a hard one, so if you don't have time to help me out it's no problem.

Thanks!

// btreeEx.h

// queue.h
// linked list implementation of Queue ADT
#include <cstddef>		 	// for NULL
#include <new>				// for bad_alloc exception
#include <iostream>
using namespace std;

template <class T>
struct Node;					// forward reference, Node defined below

template<class T>
class Queue
{
  private:
	Node<T> * front;			// pointer to front of Queue
	Node<T> * rear;			// pointer to rear of Queue
	int length;				// logical length of Queue
  public:
  	Queue();			// default c-tor
	~Queue();			// d-tor

	void makeMT();		// make Queue logically empty
	// Post: front and rear have been reset to the empty state
	bool isMT() const;		// test for Queue being empty
					// returns true if the queue is empty; false otherwise
	bool isFull() const;	// test for Queue being full
					// Returns true if the queue is full; false otherwise
	void enqueue(T item);		// enqueue an item
	// Post: parameter item is at the rear of the queue
	void dequeue(T & item);	// dequeue an item
	// Post: front of queue has been removed and …
Duki 552 Nearly a Posting Virtuoso

I found my problem. My map() function assumes a letter is being given, and maps it to an array[0-51]. When initializing my objects to have less than that, my dynamic memory was getting buggered when I would try to map anything above index 9.

Thanks for the help!

Duki 552 Nearly a Posting Virtuoso

It seems the problem might be something different, for now anyways. I ran the debugger and found that the program was crashing before it ever got to the Union() function.

If you look at my driver file (bottom), I've made comments where the program crashes.

Here is my full code:

//map.h
#pragma once
#include <iostream> 
#include <cctype> 
using namespace std;

typedef char ItemType;
const char SPACE = ' ';

int map(char ch);			// prototype

void printItem(int k);		// prototype

// map.cpp
#include "map.h" 

int map(char ch)  
{   
    if ( islower(ch) )
	 return int(ch - 'a') + 25;
    else if ( isupper(ch) )
	   return int(ch - 'A');
    else
    {  cout << "\n !! illegal input for map() !!\n";
	 return -99;  } // endif
} // end map()

void printItem(int k)
{   
    cout << SPACE;			// space
    if ( k >= 25 )
    {	k += 72;			// lowercase
	cout << char(k); }
    else
    {	k += 65;			// uppercase
	cout << char(k); }
    return;
} // end printItem()


//set.h
#include "map.h"
// Specification for SetType using explicit representation.
// File map.h must include a definition of ItemType and a function 
//  named "map" that maps an item of ItemType into an index between 
//  0 and max - 1 if the parameterized constructor is used and
//  between 0 and 399 if the default constructor is used.
class Set
{
public:
  Set();		// Default constructor: Array size is 400.
  Set(int max);	// Paramaterized constructor
  //~Set();		// Destructor
  Set(const …
Duki 552 Nearly a Posting Virtuoso

Hey everyone,

I'm trying to work with Sets. I have a function Union that takes a class type Set as it's parameter. The function returns the union of class A and B.

Here is my code:

Set Set::Union(Set setB)
{
	Set result (maxItems);
	for (int i = 0 ; i < maxItems ; i++)
		result.items[i] = (items[i] || setB.items[i]) ;

	return result ;
}
************************
//copy c-tor if you need it
Set::Set(const Set & sB)		// copy c-tor
{
	maxItems = sB.maxItems;
	items = new bool[maxItems];
	for ( int k = 0; k < maxItems; ++k )
		items[k] = sB.items[k];
}

Example Use: Set testClass = classA.Union(classB) ;

I'm getting run-time errors, and I'm fairly positive it has something to do with the use of dynamic memory in this function. I need to return the address of the new class result. Thanks for any help. If you need more of my code, just let me know.

Duki 552 Nearly a Posting Virtuoso

Awesomes. Thanks!

Duki 552 Nearly a Posting Virtuoso

Hey guys,

Can anyone tell me why this doesn't work in VS2008? I've commented out the #includes and whatnot so you can paste it into a single .cpp file and run it.

Here are my errors:

1>test.obj : error LNK2028: unresolved token (0A000320) "int __cdecl eval(class Tree<struct InfoNode> &)" (?eval@@$$FYAHAAV?$Tree@UInfoNode@@@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)


1>test.obj : error LNK2028: unresolved token (0A00032D) "void __cdecl buildExprTree(class Tree<struct InfoNode> &)" (?buildExprTree@@$$FYAXAAV?$Tree@UInfoNode@@@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)


1>test.obj : error LNK2019: unresolved external symbol "int __cdecl eval(class Tree<struct InfoNode> &)" (?eval@@$$FYAHAAV?$Tree@UInfoNode@@@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)


1>test.obj : error LNK2019: unresolved external symbol "void __cdecl buildExprTree(class Tree<struct InfoNode> &)" (?buildExprTree@@$$FYAXAAV?$Tree@UInfoNode@@@@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)

And here's the code:

// queue.h
// linked list implementation of Queue ADT
#include <iostream>
#include <cstddef>		 	// for NULL
#include <new>				// for bad_alloc exception
using namespace std;

template <class T>
struct Node;					// forward reference, Node defined below

template<class T>
class Queue
{
  private:
	Node<T> * front;			// pointer to front of Queue
	Node<T> * rear;			// pointer to rear of Queue
	int length;				// logical length of Queue
  public:
  	Queue();			// default c-tor
	~Queue();			// d-tor

	void makeMT();		// make Queue logically empty
	// Post: front and rear have been reset to the empty state
	bool isMT() const;		// test for Queue being empty
					// returns true if the queue is empty; false otherwise
	bool isFull() const;	// …
Duki 552 Nearly a Posting Virtuoso

Going to point you in the direction of another nice article (it's almost 2am here). :)

Good luck!

Duki 552 Nearly a Posting Virtuoso

Usually people who suggest Linux don't count the cost of getting everyone trained on the platform, along with the time it takes to learn how to implement Microsoft products on the platform. I'm a fan of Linux, but like most, it's just not a cost effective solution unless your entire IT department is competent... which usually isn't the case.

Duki 552 Nearly a Posting Virtuoso

Hello. Make sure you have the same username/password on both. For example, if I want to access your files, and you've allowed the user Bob with password ABCD, then I have to log on to my computer with the user Bob and password ABCD before trying to access your files. I'm pretty sure this is how it works anyways... it's been a while since I've setup a basic home network. Also, make sure both computers on in the same workgroup.

Duki 552 Nearly a Posting Virtuoso

Have you tried it? If so, did you receive any errors?

Duki 552 Nearly a Posting Virtuoso

There are sooo many ways to view the design of a datacenter. Virtualization is a whole topic on it's own.

Read this and you will have plenty of information to guide you on your project.

Duki 552 Nearly a Posting Virtuoso

Ok, if you need help with setting up an Etherchannel or if you have any more questions, just let us know. :)

You might look into purchasing some HDMI-out cards for your PCs, so that they could stream your videos straight to the television located in that room (assuming the TVs are relatively new and have HDMI ports).