|
5-3 error LNK2019: unresolved external symbol "public: class ostream & __thiscall ostream::operator<<(char const *)" (??6ostream@@QAEAAV0@PBD@Z) referenced in function _main
5-3 error LNK2001: unresolved external symbol "class ostream_withassign cout" (?cout@@3Vostream_withassign@@A)
5-3 fatal error LNK1120: 2 unresolved externals
I’m using vis studio.net
I’m in my second quarter of C++
I must have accidentally done something, because it worked before, but not it won’t even do the simplest of programs.
#include <iostream.h>
void main(void)
{
cout<<"Hello";
}
Is there a way to fix the library or reinstall what ever?
or, and better, is there a good book to use to do this by myself
Thanx
|
|
|
|
|
If you choose New Project and Win32 Project and run it.
Does it work then?
jhaga
|
|
|
|
|
It should be:
#include <iostream.h>
Hope this helps!
|
|
|
|
|
Hi
I want to have a control like the IP address control.
IP address control:
. . .
My control
- - - - -
I used a editbox and filled it like this oninitdialog().
I subclassed the CEdit to CMyEdit.
Only the first 2 characters may be typed in, then the cursor has to move to the next '-' + 1 char. further.
Any idea how to do this? and how can i get 'Backspace' to work properly? And how can i make sure when you type in the characters the ' ' is deleted. The ' ' isn't replaced by the character just typed in.
Greetings
Jens
|
|
|
|
|
Try using a masked edit ActiveX control. I've seen it on every system since Win95, so it shouldn't be a problem to use.
I haven't used it, so I can't help with it, but I know it's there and what it does (well, what it says it does, anyway )
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
You'll need to use a masked edit control. Examples on CP are plentiful.
JensB wrote:
I want to have a control like the IP address control.
Just curious but why re-invent the wheel?
|
|
|
|
|
Hi,
Now ,I have a problem.
I am programming the project need multi-COM ports.So far ,my useing programming computer is Laptop ,has one COM1 and one Modem COM2,and one Virtural Infrared COM port.But in Programming Project,I add a MSComm ActiveX controls assume it is COM5,Because there is no COM5(and there is no logic errors),so when the project compiling,the whole system is down,and blue screen,display the VxD errors,For solveing the problem ,I install a multi-COM port driver ,can add some virtual COM ports,See the attached pic(there is a link)
But I Compiled it again ,the system is down and blue screen display VxD errors!There is good solution?
|
|
|
|
|
Hi All,
I have a dilemma. I'm wrapping existing code that prints to stdout. I don't want those prints to show up on the screen, so I've redirected it using:
// redirect stdout to bit bucket
FILE* f = freopen("nul", "w", stdout);
I then created my own stream that prints to the console using:
// create a new stream to the console
fstream myStream;
myStream.open("CONOUT$");
Whatever I print using myStream shows up on the screen, which is what I want.
My problem? I can't redirect that output to a file! I push a ton of data out myStream, and really need the ability to redirect it.
Is there a limitation where only file handles associated with stdout itself, and not "CONOUT$", can be redirected to files?
Any insight on this would really, really be appreciated.
|
|
|
|
|
The following is an extract from "Conversations: Redirections", by Jim Hyslop and Herb Sutter from CUJ, to see the whole artical goto
http://www.cuj.com/experts/1903/hyslop.htm?topic=experts[^]
#include <iostream>
#include <fstream>
int main()
{
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
// do the actual work of the program;
std::cout << "This would normally go to cout but goes to the log file\n";
std::cerr << "This would normally go to cerr but goes to the log file \n";
logFile << "This goes to the log file\n";
// restore the buffers
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
}
|
|
|
|
|
Hi all. First, thanks for all the cool articles around. Really helpful.
Second, I got a dumb question:
I created a CStatic-derived class because I hate the normal groupbox MFC provided. Lets call it CBetterGroupbox.
I put in CBetterGroupbox::addMember(CWnd* member) which does member->SetParent(this). For everything that is supposedly "in" the groupbox, I call addMember. I have to do this since the draw order of MFC put all my buttons "under" the CBetterGroupbox background. It works fine. The controls are now drawn after CBetterGroupbox::OnPaint is done.
However, now when I click a button, the handler in the main dialog is not called, probably since the message map now sends the ON_BN_CLICKED messages only to the CStatic level, not to CDialog level. How do I fix this? Is there any easy way to pass all the messages a class receives up to its parent?
Desperately looking for help.
|
|
|
|
|
You can do this overriding OnCommand() and send a WM_COMMAND messages to the parent in response, such as
CBetterGroupbox::OnCommand(WPARAM wParam, LPARAM lParam)
{
CWnd *pParent = GetParent();
ASSERT_VALID(pParent);
pParent->SendMessage(WM_COMMAND, wParam, lParam);
}
This should take care of any control command messages, but it won't help with common controls that use WM_NOTIFY messages.
However, a better way would be to call SetOwner() on the child windows to set their owner to the dialog box. This will cause all the control messages to be sent to the dialog box instead of the group box. I'm not sure if this works for common controls, though. I think it does, but perhaps you can test it
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
A CGI program written in C++, printing using the Win32 API, is run by IIS. Instead of routing the output printer file to the printer it tries to return it to the browser. Apache and Tomcat successfully route the printer file to the printer. Does anyone know why IIS is doing this?
|
|
|
|
|
How are you opening and printing to the printer? Remember that CGI hosts remap and capture the standard output streams (for ease of development of CGI progs) and redirect the output back to the browser. Also, remember that typically IIS runs under the LocalSystem account and does not have access to network resources.
|
|
|
|
|
I am trying to copy contenst of the client area in the window, from a C++ appliation to the MS Word. I am trying to copy to a clipboard using CMetaFileDC and I would like to paste it to the word project. This is what I have so far.
if ( OpenClipboard() )
{
EmptyClipboard();
//create the metafile DC
CMetaFileDC * cDC = new CMetaFileDC();
cDC->CreateEnhanced(GetDC(),NULL,NULL,"the_name");
//DRAWING PROCEDURE USING cDC....
//close meta CMetafileDC and get its handle
HENHMETAFILE handle = cDC->CloseEnhanced();
//place it on the clipboard
SetClipboardData(CF_ENHMETAFILE,handle);
CloseClipboard();
//delete the dc
delete cDC;
}
_Application objWord;
COleVariant vtOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR),
vtTrue((short)TRUE),
vtFalse((short)FALSE);
// Get the IDispatch pointer and attach it to the objWord object.
if (!objWord.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't get Word object.");
return;
}
objWord.SetVisible(TRUE); //This shows the application.
I am suck in opening the MS Word project and I can't seem to paste the contents of the clipboard. Is this logic correct. Does anybody have a suggestion on how to paste the contents of the metafile??? Thanks.
|
|
|
|
|
Okay I'm totally new to MFC and I have no idea how I can stop my program from quitting everytime I press Enter Anyway, I have two Edit controls, one is for entering the text and the other is more of an info box (I'm making a game if you really want to know).
Also if anyone could help me figure out what the best way of appending the message text to the main text, it would help a lot I'm just planning on using Copy() and Paste atm...
|
|
|
|
|
One solution is GetWindowText() and SetWindowText().
Kuphryn
|
|
|
|
|
|
hello
i had find an interesting class ,i want to add it to a project that i made ,but i had a problem when i add the file source and the headers of this class to my project.
i have the following error message when i compile and it is only in the *.cpp files it ask:
fatal error C1010: unexpected end of file while looking for precompiled header directive
and i include the header files of the source code.
can you help me
|
|
|
|
|
Add this:
#include "stdafx.h"
at the top of the file that's causing the error.
|
|
|
|
|
Try including stdafx.h into the class file.
Do Lipton employees get coffee breaks?
|
|
|
|
|
Try this:
if it complains something about precompiled headers then
choose the file, press the right mouse button, settings and
change Category to Precompiled Headers, and check
Not using precompiled headers
jhaga
|
|
|
|
|
ok it's run thank you for your help
|
|
|
|
|
i have another problem ,when i want to add OpelGL lib like glut and glu, when i go to "Project Setting" and link and in Object/library modules i can't add the lib i find it empty.
what is the problem in that?
|
|
|
|
|
i have another problem ,when i want to add OpelGL lib like glut and glu, when i go to "Project Setting" and link and in Object/library modules i can't add the lib i find it empty.
what is the problem in that?
|
|
|
|
|
In the Object/library modules, just type in "glu32.lib" and if you need it, also add "glaux.lib".
Chris Richardson Terrain Software
|
|
|
|