|
Hi,
I tried to merge two projects together. The second (some OpenGL things) doesn't use precompiled headers at all, in those files I get errors when compiling.
Is the a precompiler pragma to disable use of precompiled headers for a file?
|
|
|
|
|
#pragma no_pch
does NOT work to suppress precompiled header, hmm any idea?
|
|
|
|
|
I case you're satisfied with a solution not involving pragmas, you can go to Project->Settings and tune the precompiled headers feature for each file separately (just click on the file alone instead of the whole project and search thru the tabs for it.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
a solution with pragma would be very convenient
if someone has a solution or a workaround, let me know. thx
|
|
|
|
|
|
Rama Krishna wrote:
look at #pragma hdrstop
and then?
#pragma hdrstop alone doesn't help, still the same compiler error
|
|
|
|
|
In project settings, c++ tab, precompiled headers in the dropdown. Then select the files you don't want precompiled headers from the tree on the right, and pick "Not using precompiled headers".
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Hi:
I am stuck at converting a CString to a float number and actually determining if the string is a number. In other words I want to be able to tell that
"23" is 23
"23.554" is 23.554
"gdfgd" is invalid
"34.4353n" is invalid
"45.45.34" is invalid
etc.
Any thoughts????
Thank you
|
|
|
|
|
I don't know about case 4, but here's a quick and dirty check:
bool convertToFloat
(CString& strNumber,
float& fValue)
{
float floatValue = 0.0;
if (sscanf (strNumber, "%f", &floatValue) == 1) {
fValue = floatValue;
return (true);
}
return (false);
} /ravi
Let's try putting "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have posted an article with some helper functions.
http://www.codeproject.com/cpp/helper_functions_01.asp
One of these is an IsDecimal. You can strip the IsDecimal function and use it sperately from the rest if you want. You should be able to combine IsDecimal and a call to atof to achieve what you want.
|
|
|
|
|
You could loop through all the chars in the string and use the isdigit() function on each char...
There might be faster ways, just an idea...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
_tcstod(...) and its non-unicode equivalent let u pass the number string to convert and a pointer to the char that ended the conversion ... when it returns examine the pointer to the char that ended the conversion and see if its a '\0' ... if it is then the string was all numeric else it wasn't
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Could you use the atof function.
If it returns 0.0 then it can't be converted to a nummer, otherwise it will return the number.
-Raffi
|
|
|
|
|
Okay, what about if the value is "0.0"?
"One good thing about getting older, you don't lose the ages you've been!"
|
|
|
|
|
|
Hi, if somebody could just give a look at this code :
Iknow it's not C++, it's only C....
I don't know what I do wrong....
Thanks a lot
Starn
[code]
/* This little piece of code initiate 2 queue
**First queue is filled of empty buffers
**second queue is filled with the full buffers
**PROBLEM : I can only fill the 2 first buffers in the FOR loop
** queueX.h contains the TAILQ macros. (see after the main function...)
*/
//I know, I don't need all these includes... (it's for other functions...)
#include <stdio.h>
#include <unistd.h>
#include <atomic.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <net/if_types.h>
#include <netinet/in.h>
#include <sys/syspage.h>
#include <sys/neutrino.h>
#include <syslog.h>
#include <sys/dispatch.h>
#include <sys/io-net.h>
#include <string.h>
#include <stdbool.h>
#include<sys/queueX.h>
#define NB_BY 192 // 192 bytes = 1536 bits = 2x 48 échantillons de 16 bits car 1 ms = 2 x 48 ech à 48000Hz
int msg_thread_send;
TAILQ_HEAD(buffers,entry) head;
struct buffers *headp;
struct entry{
char data[NB_BY];
TAILQ_ENTRY(entry) entries;
} *n1, *n2, *n3,*n4,*n5, *np,*sendp,*ready_sendp;
TAILQ_HEAD(send,entry) head_send;
struct send *head_sendp;
int main()
{
FILE *file1;
int i, file_size;
if ((file1 = fopen ("/home/s_16_44.wav", "r")) == 0)
printf ("can not open file\n ");
fseek(file1, 0, SEEK_END);
file_size=ftell(file1);
fseek(file1, 48, SEEK_SET);
TAILQ_INIT (&head);
TAILQ_INIT (&head_send);
n1 = malloc(sizeof(struct entry)); /* Insert at the head. */
TAILQ_INSERT_HEAD(&head, n1, entries);
n2 = malloc(sizeof(struct entry)); /* Insert at the tail. */
TAILQ_INSERT_AFTER(&head, n1,n2, entries);
//TAILQ_INSERT_TAIL(&head, n1, entries);
n3 = malloc(sizeof(struct entry)); /* Insert at the tail. */
TAILQ_INSERT_AFTER(&head, n2,n3, entries);
//TAILQ_INSERT_TAIL(&head, n4, entries);
n4 = malloc(sizeof(struct entry)); /* Insert at the tail. */
TAILQ_INSERT_AFTER(&head,n3, n4, entries);
//TAILQ_INSERT_TAIL(&head, n4, entries);
n5 = malloc(sizeof(struct entry)); /* Insert at the tail. */
TAILQ_INSERT_TAIL(&head, n5, entries);
for (np = head.tqh_first; np != NULL; np = np->entries.tqe_next)
{
fread(np->data,NB_BY,1,file1);
if(np=head.tqh_first)
{
TAILQ_INSERT_HEAD(&head_send, np, entries);
printf("insert_head\n");
}
else
TAILQ_INSERT_TAIL(&head_send, np, entries);
printf("insert_queue\n");
}
np=head.tqh_first;
//ready_sendp=head_send.tqh_first;
// ICI, démarrer le thread_send
while(1)
{
if(msg_thread_send) //tant que le thread_send n'a pas mis ce bit à , il n'y a pas de buffer de libre
{
fread(np->data,NB_BY,1,file1);
// if(j>4)
//{
TAILQ_INSERT_TAIL(&head_send, np, entries);
//voir si il ne faut pas retirer le premier élément de la queue_send (memory leacks) ca devrait être arrangé avec TAILQ_REMOVE
np = np->entries.tqe_next;
msg_thread_send=0;
}
if( np == NULL) //si on est au bout de la queue, on revient au début...
np=head.tqh_first;
}
// printf("data : %c\n",n1->data);
fclose(file1);
return(0);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* Tail queue declarations.
*/
#define TAILQ_HEAD(name, type) \
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
#define TAILQ_ENTRY(type) \
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}
/*
* Tail queue functions.
*/
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_FOREACH(var, head, field) \
for ((var) = TAILQ_FIRST((head)); \
(var); \
(var) = TAILQ_NEXT((var), field))
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = TAILQ_LAST((head), headname); \
(var); \
(var) = TAILQ_PREV((var), headname, field))
#define TAILQ_INIT(head) do { \
TAILQ_FIRST((head)) = NULL; \
(head)->tqh_last = &TAILQ_FIRST((head)); \
} while (0)
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
TAILQ_NEXT((elm), field)->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_NEXT((listelm), field) = (elm); \
(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
} while (0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
TAILQ_NEXT((elm), field) = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
} while (0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
TAILQ_FIRST((head))->field.tqe_prev = \
&TAILQ_NEXT((elm), field); \
else \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
TAILQ_FIRST((head)) = (elm); \
(elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
} while (0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
TAILQ_NEXT((elm), field) = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &TAILQ_NEXT((elm), field); \
} while (0)
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_REMOVE(head, elm, field) do { \
if ((TAILQ_NEXT((elm), field)) != NULL) \
TAILQ_NEXT((elm), field)->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
} while (0)
[/code]
|
|
|
|
|
Hi,
I have a COM Interface where I want to define a method which returns a class pointer but it's giving MIDL2025/MIDL2026 error. If any one has any idea plz help me.
Uttam
Regards;
Uttam Kumar
|
|
|
|
|
What does your IDL code look like that you are trying to compile?
One other thing, if you return a C++ class pointer then you will not be able to use your COM object in any other language than C++, are you sure that is what you want to do?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi Kilowatt,
Thanks for ur knid and quick response. Yes Kilowatt I'm using C++ client only and want to see the structure of IDL file. In fact I'm trying to do something similar to
[id(2), helpstring("method GetSeExceptionPtr")] HRESULT GetSeExceptionPtr([out,retval]CSeException *pSe); // Where CSeException is a C++ class in my IDL file but it's giving error code MIDL/2025/2026.
Plz help me and if possible plz send me a block of code too.
Thanks for giving time once again.
Regards;
Uttam Kumar
Regards;
Uttam Kumar
Senior Development Engineer
Omitec Information Services Ltd.
Mobile : +44 (0)77 5494 2930
Direct line : +44 (0)24 7660 8508
Direct Fax : +44 (0)24 7660 8501
e-mail : uttam.kumar@omitec.com
Website : www.omitec.com
|
|
|
|
|
does your class need to have methods? If not, you could make up a IDL structure. If you need methods, make up an interface. I don't think this is a good idea to pass C++ classes betweeen interfaces, even if the client and the server are both in C++.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
This should be simple.....you would think
I have a listbox with LBS_SORT, and adding item to it with LBS_ADDSTRING.
But the items are *not* sorted!?
Someone got a clue to why this is happening?
The LBS_SORT is set in the dlg editor.
I have verified with spy++ that it is set.
The listbox is NOT ownerdraw.
(and i dont get any WM_COMPAREITEM calls, which i shouldn't get either)
/Magnus
|
|
|
|
|
Hi there,
I'm writing a gdi game ...
I used WM_MOUSEDOWN - WM_MOUSEUP - WM_MOUSEMOVE events for darging and droping ...
I have still problem for solving flickering image
The problem is it, when i drag-drop my bitmap in the dialog, image has flickering problem !!!
I drew the image in OnPaint()
I redraw that by InvalidateRect function ...
Could u help me please !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
There are many solutions to flickering. Likely, your biggest problem is that your WM_ERASEBKGRND is drawing a white rectangle everytime you invalidate, and before you repaint your image. Override WM_ERASEBKGRND and do something more intelligent.
Another option are Memory DC's, which you can draw into and then blit into your physical DC all at once. There are several samples of both here at CP.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Thanks aloooooooot for ur reply
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hello again
I have just one other problem about OnEraseBkgnd event !
Right now, i solved my pervious problem that was about Flickering image in the dialog by returning FALSE in that message !!!
Now, i want to know how could i refresh the image in each movement ?!!!
Because, i can't use Invalidate() or InvalidateRect() functions ...
Could u help me in it, please
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|