|
Hello everyone, I'm relatively new to writing code in C++ and I've been running into a problem. You see, I got a chunk of code off the internet for use in my program and it includes:
using namespace System
But the compiler doesn't like it. From what I can tell it isn't declared in the body of the code and it sounds rather like a predefined namespace. Is there something I need to include to fix this or what? Thanks in advace
|
|
|
|
|
That sounds rather like C++/CLI, i.e. C++ using .NET.
To get that working, you'll want to pass the /clr flag to the C++ compiler - and probably point questions at the C++/CLI forum, as they'll have more of a clue with C++/CLI.
|
|
|
|
|
I am thinking that the statement you want is:
using namespace std;
The namespace std is predefined in C++. The statement:
using namespace System;
should work if you have already defined the name space called System. Have you done so? I hope this helps, if not feel free to ask a follow up question.
Bob
|
|
|
|
|
linkfitz wrote: But the compiler doesn't like it.
Exactly what error message you got while compiling?
Make sure the following,
1) System namespace is applicable only for Managed C++.
2) Did you forget to put a semi-column? Apparently its missing from the code snippet that you've provided.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
How would I go about making it Managed? (I'm sorry but I'm really bad with that kind of stuff.) And yes, I have a semi-colon, Ha-ha.
|
|
|
|
|
I hope you are using Visual Studio with CLR support. You can create a managed C++ project by File -> New Project > CLR -> <lot of="" managed="" templates=""> I referred Visual Studio 2008 and the sequence can vary depends on the version you are using.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Good Morning All
I am currently working on a project involving an ultrasound machine.
The ultrasound machine puts out audio and a PC is supposed to receive it through the line in port. I was wondering if any of you kind users could point me in the right direction to receive this data with C++.
I have of course done some searching but the words "line" and "c++" are causing my search results to be horribly inaccurate.
Thank you in advance
Shane
|
|
|
|
|
Maybe try looking into using DirectShow, at the first look it might seem complicated but if you get to know it's not that hard. True, i didn't use it for capturing audio yet though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
DirectSound has audio capture capabilities[^]. That page also mentions waveInOpen[^], which looks like it does audio capture.
The main trick then is identifying how to specify the line-in port!
|
|
|
|
|
Hello,
I've got a few projects I'm attempting to cleanup. They are all in VSS and in the parent directory for a few projects reside a file with the '.vssscc' extension.
Should they be removed? I thought they were a local repository for what files have been added to VSS. Doing some reading I understand that the information contained in the files is supposed to represent which files to exclude from the project's source tree in VSS.
Upon inspection in find:
""<br />
{<br />
"FILE_VERSION" = "9237"<br />
"ENLISTMENT_CHOICE" = "NEVER"<br />
"PROJECT_FILE_RELATIVE_PATH" = ""<br />
"NUMBER_OF_EXCLUDED_FILES" = "0"<br />
"ORIGINAL_PROJECT_FILE_PATH" = ""<br />
"NUMBER_OF_NESTED_PROJECTS" = "0"<br />
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"<br />
}<br />
which seems to contradict file exclusion.
Is it safe to remove these files from source control?
|
|
|
|
|
Hi~I am working a window form , with a picture box,label and numericUpDown
the picture box's image is like a compass ,when I change the value in numericUpDown->value, it is from 180 to -180, left is +ve and right side is -ve.
The label will show the corresponding value like north,N30E....
but when I work in the from 90 to 180,
what I decide is an eqatuion like numericUpDown->value - 2*n,where n is from 1 to 89.
There is no problem when I increase it from 91 to 179,it will shw the correct value from N89E to N1E, but when from 179 to 91,there will be problem. Moreover, if the numericUpDown->value is just change up and down, bb will also accumulate..so the value display in the label will be wrong...I really don't know how to write...
if(numericUpDown2->Value > 90 && numericUpDown2->Value < 180)
{ //a= numericUpDown2->Value;
cc = Convert::ToDouble(numericUpDown2->Value);
cc=cc-(2*bb);
aa=Convert::ToString(cc);
if(bb<89)
{bb=bb+1;}
else
{bb=1;}
label12->Text="N"+aa+"E";
}
|
|
|
|
|
OK, I am very confused by this. You seem to have 3 things going on, and I'm not sure where the problem actually is. It doesn't help that your code is looking very un-MCF/C++ like. Maybe you should be in the Managed C++/CLI forum?
1/ You have an Up-Down control (which I think of as a spinner, but you're actually correct). I'm confused what you're setting the range to. I think it's from -180 to +180
2/ You handle either the WM_NOTIFY/UDN_DELTAPOS or WM_HSCROLL/WM_VSCROLL messages sent from the up/down control. Do you get the correct values?
3/ Then you have to translate the -180 to +180 bearing value into a nice text representation. You can probably be hyper clever, but I'd suggest you do something like:
if (bearing >= 0 && bearing <= 45)
{
} else if (bearing >= 45 && bearing <= 90)
...
As I suspect you're posting in the wrong forum, I'll stop now. But the idea is to just break your problem down into ever smaller bits, and see where you fail.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi,
I need to display ~ 100000 entries in a windows list which are stored in an SQL database (queried by a SELECT query with a few JOINs).
1st question: In only need to display a simple list. I would really like to use a Listbox Control for the sake of simplicity. Do I really need to choose a (complex) List Control?
2nd question: I tried a virtual list with a simple SQL query:
OnInitDialog()
...
m_ctrlWords.SetItemCountEx(count);
....
OnLvnGetdispinfoWords(...)
...
sql.Format("SELECT keywordID, keyword FROM keywords ORDER BY keyword LIMIT %d, 1", index);
const char *res = query.getStringField("keyword");
lstrcpy(pItem->pszText, res);
but this is really too slow.
I think I need OnLvnOdcachehintWords but it's somehow complicated. I could not find any concepts (which data structure to choose??) or examples concerning this
The problem is that I have to remove old entried in cache (or my app's memory consumption would explode).
Does anyone have implemented such a virtual list (with data in SQL) already?
Are there some examples or concepts available?
Thank you very much,
Niki
|
|
|
|
|
You'll probably be better off executing something like "SELECT keywordID, keyword FROM keywords ORDER BY keyword" within OnInitDialog and caching the results in a resultset or whatever equivalent your database interface technology offers. Then you can interrogate the cache within OnLvnGetdispinfoWords and don't need to bother with OnLvnOdcachehintWords .
|
|
|
|
|
Hello,
I have to correct: The entries are much more than 100000...it's a fulltext recherche of a huge database system.
So it's definitifely too large to just read out all entries and cache them.
Regards,
Niki
|
|
|
|
|
I have tried it using caching and virtual list controls. Even if I read only the elements from LVN_ODCACHEHINT and cache them into a map, the list is really, really tooo slow.
What could be the solution? I just want to have the same as WinHelp32's keyword (or topic) search. For some reason, this list is very very fast since over 10 years (with slow computers).
Regards,
Niki
|
|
|
|
|
nobaq wrote: I have tried it using caching and virtual list controls. Even if I read only the elements from LVN_ODCACHEHINT and cache them into a map, the list is really, really tooo slow.
I'm surprised - I've implemented virtual lists that provide views over 10s of thousands of rows (and 10s of columns) of data - they've been as quick as you could want.
I feel sure you're using the right technology (virtual list controls) but there's something not quite right about your implementation?
|
|
|
|
|
One other thing - have you profiled the code to see what is slowing it down?
I'd suggest implementing a virtual list control that just displays the numeric index of the list rows, to convince yourself that you've got the virtual list control set up correctly. Then work out how much of the SQL query you can do without taking too much time, and you can try to merge that into the list control implementation?
|
|
|
|
|
OK - in that case, you want to cache maybe a couple of hundred rows starting at the row that's at the top of the list control. Then, as users move down the list, you can retrieve a few hundred rows at intervals, when required?
|
|
|
|
|
nobaq wrote: I need to display ~ 100000 entries in a windows list...
Why? Who would want to navigate through such a list?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Just look at winhelp32 fulltext- or keyword search.
This is exactly what I want to implement.
Regards,
Niki
|
|
|
|
|
Use a CListBox,in virtual mode.
If I remember correctly, You will need to manually draw and manage the data, but it will make the CListBox
very fast; once you know how to do it, you will use it everywhere.
You will need to override the CListBox::DrawItem (and maybe the CListBox::MeasureItem )
|
|
|
|
|
Hi, thank you for this hint.
I've been searching for a while now but I can not find any docs
Do you have a reference, docs, howtos for subclassing CListBox in order to implement a virtual listbox?
Any anyway, how do I query data from my database when "scrolling" very fast? I think i need to minimze my database queries but on the other hand I need to display something while scrolling...
Regards,
Niki
|
|
|
|
|
Hi
I've searched documentation and I can't find any answer to my problem.
I'm trying to burn an iso image. I call SHCreateStreamOnFileEx to get a stream from file and pass the stream to DiscFormat2Data->Write.
It all works fine but is there any way to set the name of CD ?
Currently when I'm opening an iso file, for example "NAME_DIGITS_MORE_DIGITS.iso"
my CD is called "NAME". I would like the disc to have the same name as the image.
I saw the function put_VolumeName but I can only use it when I'm creating an image myself.
The iso I'm trying to burn are made by other application
Can someone help me?
|
|
|
|
|
In which case CWnd::SubclassWindow(HWND DocumentList) fails, I have locally declared and initialized DocumentList which is used as the the parameter?
Software Developer
Sanjay Khapre
modified on Wednesday, January 7, 2009 10:03 AM
|
|
|
|