|
|
A static method can be inlined if the compiler decides to do so, and an inline function might be instantiated as a callable function. Its all up to the compiler. In general it can easily happen that a compiler creates both an inlined and instantiated version of the very same function (no matter if its static or inlined).
|
|
|
|
|
Reference: http://stackoverflow.com/questions/8982965/printing-in-mfc-application[^]
Question #1: I have a Dialog based app using sample code taken above. App runs fine. I want to avoid having the popup printer selection window appear once the print job is started (i.e. when PrintDocument() is called). I just want to print to the default printer. How can I do this?
Issue #2:
This dialog app itself creates numerous other new dialog windows depending on user's selection.
There is a need to have many of the features provided by this dialog application implemented as command line features.
What did I do? ...
Upon app started, I created a modeless dialog object with the intent not to display the dialog (unless absolutely necessary).
Some of the dialog methods do function. The method that handles the printing does not work.
The code fragment that causes a problem is CBatchResultsDlg::WaitForComplete() - because of AfxPumpMessage(). The owner of the CHtmlEditCtrl object is the Desktop window because setting the dialog window creating the object as owner fails.
How can I fix this such that my printing will work.
|
|
|
|
|
Hello all. I'd like to set up, correctly, an UNIX (Ubuntu) environment so I can compile and test the network programs from the Unix Network Programming 3rd edition book by Richard Stevens. Please, I'm really lost. I don't know what to do.
modified 12-May-13 14:54pm.
|
|
|
|
|
1. This has nothing to do with C++.
2. There is lots of help on Unix available via Google.
However, Richard Stevens books assume that you have a compiler and linker installed on your system. The most common one in use is gcc, free from here[^].
Use the best guess
|
|
|
|
|
I asked because, for example, when I compile this code:
#include <stdio.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <strings.h>
#define MAXLINE 100
int main(int argc, char* argv[])
{
int sockfd, n;
char recvline[MAXLINE + 1]; /* string onde sera' colocado o dado */
struct sockaddr_in servaddr;
if(argc != 2)
{
fprintf(stderr, "utilizacao: daytime <endereco IP>");
}
if( (sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
fprintf(stderr, "erro no socket");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(13); /* tempo do servidor */
/* inet_pton - convert IPv4 and IPv6 addresses from text to binary form */
if(inet_pton(AF_INET, argv[1], &servaddr.sin_addr)) < 0)
fprintf(stderr, "erro inet_pton para %s", argv[1]);
if(connect(sockfd, (SA*) &servaddr, sizeof(servaddr)) < 0)
fprintf(stderr, "erro de conexao");
while((n = read(sockfd, recvline, MAXLINE)) > 0)
{
recvline[n] = 0;
if(fputs(recvline, stdout) == EOF)
fprintf("erro de saida");
}
if(n < 0)
fprintf("erro de leitura");
}
I get lots of problems. In particular, I don't have the machine directory but I have installed gcc and build-essential:
In file included from /usr/include/x86_64-linux-gnu/machine/_types.h:34:0,
from /usr/include/x86_64-linux-gnu/sys/_types.h:33,
from /usr/include/x86_64-linux-gnu/sys/socket.h:37,
from /usr/include/netinet/in.h:25,
from /usr/include/arpa/inet.h:23,
from daytime.c:2:
/usr/include/x86_64-linux-gnu/i386/_types.h:79:3: note: previous definition of ‘__mbstate_t’ was here
In file included from /usr/include/netinet/in.h:25:0,
from /usr/include/arpa/inet.h:23,
from daytime.c:2:
/usr/include/x86_64-linux-gnu/sys/socket.h:39:28: fatal error: machine/_align.h: Arquivo ou diretório não encontrado
compilação terminada.
|
|
|
|
|
I don't know why that directory has not been found. You need to go back to the build/install log for gcc and see if you can find out what happened.
Use the best guess
|
|
|
|
|
so, is that a standard directory of UNIX? I found it quite strange too that's why I will install Ubuntu 13.04 (I'm using Ubuntu 12.10).
|
|
|
|
|
noislude wrote: is that a standard directory of UNIX? I'm not sure, but I assume it is a standard part of the gcc package and should be installed with gcc.
Use the best guess
|
|
|
|
|
|
I solved the problem after installing Ubuntu 13.10. I think there was something broken in my OS. Thank you for your attention.
|
|
|
|
|
Hello guys:
any way, after i have finished writing my program i have recived an error it is like that :
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>stdafx.obj : error LNK2019: unresolved external symbol "public: __thiscall list::~list(void)" (??1list@@QAE@XZ) referenced in function _main
fatal error LNK1120: 1 unresolved externals
this is the error from compiler, by the way i am using a visual studio 2010 ,
|
|
|
|
|
have you looked at file stdafx.h?
|
|
|
|
|
what should i looking for ? in "stdafx.h" file??
|
|
|
|
|
Well are you using an external C library?
Your error is with the linker, and the function name has been mangled by C++ because somewhere in your code there should be
#ifdef __cplusplus
extern "C" {
#include ...
#endif
.
.
.
#ifdef __cplusplus
}
#endif
Not likely to be stdafx.h but I thought it worth asking because it's related to stdafx.obj
|
|
|
|
|
OmarSH wrote: this is the error from compiler No, this is the error from the Linker; you need to understand the difference.
Use the best guess
|
|
|
|
|
ok guys i am beginner ,what should i do exactly to solve this error ,even i don't know what is the linker ,
|
|
|
|
|
We need to see some of your code to be able to figure out what is going on. The first message implies that there is some confusion between c and C++ code in your project. The second message suggests that you have a call to a list destructor in your code.
For information on the linker (and building programs in general) see http://msdn.microsoft.com/en-us/library/91621w01(v=vs.71).aspx[^].
Use the best guess
|
|
|
|
|
it worked man,i delete the destructor
but not from long time i have been getting something like that "Cannot find or open the PDB file"
this message is repeated to about thirty file ,and make my console program end with out the normal message (press any key to continue....)
|
|
|
|
|
I am not sure what you are saying here, but it may be that you need to do a Clean and Rebuild of your project(s).
Use the best guess
|
|
|
|
|
this is part of the compiling:
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'TRY5.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
|
|
|
|
|
OmarSH wrote: this is part of the compiling: No, this looks like the debug window of Visual Studio when you are trying to execute your program.
You really need to go to that link I provided for you, and learn and understand how programs are built and executed, and the differences between the various phases of that process.
Use the best guess
|
|
|
|
|
OmarSH wrote: 1>stdafx.obj : error LNK2019: unresolved external symbol "public:
__thiscall list::~list(void)" (??1list@@QAE@XZ) referenced in function _main Is the list object being referenced yours or the one from the STL? If the former, it's missing a destructor.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi all,
I ask me of myzelf what kind of Timers APi can I use for create an delays of microseconds?
I read the MSDN site and I found the topics of different manners for create function that generates an delay of microseconds.
Witch one is the best solution for my problem if the user set the delay in microseconds and the function executes the adjustable microseconds of the user.
I hope that here developers knowledge the WinAPI and low level programming. I work under Windows XP/7
We have the chooice of:
1 Multimedia Timer
2. Waitable Timer
3. Queue Timer
1) Whitch is the best chooice of this timers?
2) How can I rewrite the code for use in microseconds?
3) I wish to change in the exists functions (see above) for programming the functions that using the microsecond
(delay) timer. I don't know how I can change this in the code:
DECLARE SUB TimeInit_us()
DECLARE FUNCTION TimeRead_us() AS QUAD
DECLARE SUB Delay_us(BYVAL wDelay AS WORD)
'------------------------------------------------------------------------------
' TIME functions
'------------------------------------------------------------------------------
' This set of functions is important for various time measurements. Just as
' with DELAY function (in ms) and Delay_us (in µs), TIME functions also operate on millisecond or
' microsecond basis.
' TIMEINIT (in ms) and TIMEINIT_US (in µs) will reset the timers to zero and start them again
' with ms or us precision
' TIMEREAD (in ms) and TIMEREAD_US (in µs) functions will read the amount of time (in ms or us)
' since the last TIMEINIT or TIMEINITUS function was executed. Both functions
' return a 64-bit integer
4) How can I combine it to an Quad word (64 bit)?
[code]
#Dim All
#Include "Win32API.inc"
Type LARGE_INTEGER
low_part As Long
high_part As Long
End Type
Global g_TimeUnit As Double
Global g_Start_Time_Low As Long
Global g_Start_Time_High As Long
'========================================================================='
'Milliseconds Delay Timer Functions '
'========================================================================='
Sub TimeInit()
'==============================================='
'Reset the milliseconds Timer to Zero
'will reset the timers to zero and start them again with ms precision
'===============================================
Local f As LARGE_INTEGER
Local t As LARGE_INTEGER
Local x As Dword
x = QueryPerformanceFrequency(f)
g_TimeUnit = 1000 / f.low_part
x = QueryPerformanceCounter(t)
g_Start_Time_Low = t.low_part
g_Start_Time_High = t.high_part
End Sub
Function TimeRead() As QUAD
'=======================================
' TIMEREAD functions will read the amount of time (in ms)
' since the last TIMEINIT function was executed. The function
' return a 64-bit integer
'=======================================
Local t As LARGE_INTEGER
Local x As Dword
If(g_TimeUnit = 0) Then g_TimeUnit = 0.000838096515
x = QueryPerformanceCounter(t)
Function = (t.high_part * 4294967296# + t.low_part - g_Start_Time_High * 4294967296# - g_Start_Time_Low * g_TimeUnit)
End Function
Sub Delay(ByVal wDelay_time As Word)
'=============================================
'With the DELAY function is important for various time measurements. Just
'as with Delay function, Time function also operate on ms basic
'=============================================
Local time_start As Double
time_start = TimeRead()
While(TimeRead() < (time_start + wDelay_time)) : Wend
End Sub
[/code]
I hope that here someone help me but I can't written the functions for the microseconds timer
Kind regards
Stephane
|
|
|
|
|
Which programming language do you want help with?
Remove your VB code if you now want help with C/C++, or delete your message.
|
|
|
|