Answer Questions
swapna_n C++/CLI Types
Hey All, When I was using Managed C++ back in the old days of VS03, I remember being very careful to use Int16 instead of short, and Strings instead of std::strings. I'm wondering how much of a difference that makes w/ the new CLI. Is "int" equivalent to "Int32" as far as garbage collection and such Also, I caught myself doing this today when I declare variables. String ^str; but when i do my arrays, I put the handle like this... array<String^>^ str; Where is the 'proper' place to put the cap The standard just defines something like this sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) Hmm - I thought to remem ...Show All
StuartGM MFC8
hi i am programming with vc++ express and i have MFC4 and i am looking to upgrad to MFC8 .is that possible and how Moved to C++ General forum. Search for WTL (Windows Template Library). It is a free download - I think on sourceforge. You should find a bit of documentation and samples on there too. Some guys at ww.codeproject.com have also some samples, tutorials or enhencements. -- SvenC but is there some special component to make a nice interface WTL requires the ATL headers so that's not an alternative. The designated GUI framework for the Express editions is Windows Forms. You'll have a pretty steep learning curve, ...Show All
msdobrescu2 Double quotes in in strings....
There is a string: dotnetfx.exe /q /c:"install.exe /q" How does one hand double quotes in something like this if ( ! IsInstalledFramework()){ShellExecuteAndWait(_T( "dotnetfx.exe\0" ),_T( "/q:a /c:\\" install /l /q "\0" ), true );} Thanks... You have two \\ , which creates a \. \" creates quotes. if ( ! IsInstalledFramework()){ShellExecuteAndWait(_T( "dotnetfx.exe\0" ),_T( "/q:a /c:\" install /l /q\ "\0" ), true );} You shouldn't need the \0, your constant strings should be null terminated by the compiler, at least I would have expected that to be the case. Thank you Christian. ...Show All
stevejebson Pointer not working
When ever I try to compile the code below I get this error: " error C2102: '&' requires l-value " ICI is a pointer to an unmanaged class, this is being done with in a managed class. X is a double pointer, where as XPostion_Meters is just a double. ICI->ICOList[Count].X = &IPObs[Count]->IPObj->XPostion_Meters; Any help would be appreciated NeederOfVBHelp wrote: ok after looking at the definition I realize that the problem is that it is a property ... but is there a way to do what I am trying to do Short answer: no. You can't bind a double pointer to a property. Consider redesigning the application, so that you don't need this pointer. sor ...Show All
andyedw Building/linking DirectSound app
Hello all, I'm having trouble building my first DirectSound app. I'm using VS2005 (C++) and have done the following: 1) Selected "Project -> MyProject properties -> C/C++ -> General" and added "C:\Program files\Microsoft DirectX SDK (June 2006)\Include" to "Additional Include Directories" field. 2) Selected "Project -> MyProject properties -> Linker -> General" and added "C:\Program files\Microsoft DirectX SDK (June 2006)\Lib\x86" to "Additional Library Directories" field. 3) Selected "Project -> MyProject proeprties -> Linker -> Input" and added "Dxguid.lib Dsound.lib" to "Additional Dependencies". 4) In header ...Show All
Humblepatience Extracting a random number in (0,1]
Hi everyone! How can I extract a random number between 0 and 1 (0 excluded) in c++ Thanks! Thanks! ps: how did you write the code in that way in the forum Martin Richter wrote: This can't be a solution. rand gives numbers between 1 and RAND_MAX. So the formular must be double rnd = (static_cast<double>(rand())+1)/(RAND_MAX+1); That would work too. rand() is documented as returning a value in the range 0 to RAND_MAX (hence my +1, to avoid divide by zero errors). 1 divided by any number > 0 will be a value between 0 and 1. Actually, upon reflection simply adding 1 could produce a divide by zero (-1 + 1 == 0), so it should be value == 0 1 : value. ...Show All
czkiam Compile error within code in #ifndef
This is probably just me missing something obvious, but .... I've got a VS C++ program with a section of code patched out via an #ifndef NAME.... #endif section. The NAME is defined by a /D option on the command line (which appears correctly looking on the Properties page). Within the editor, the correct section of code is grayed out, so the editor at least is handling the #ifndef NAME correctly. However, when the application is built I get a compile error on one of the lines inside the #ifndef section -- it looks like the compiler is either ignoring the #ifndef or somehow the NAME has become un-defined. (I did do a search for NAME within the entire solution, and it is never #undef'd.) Changing it to an #if 0 compiles as expected. Any thou ...Show All
Nazgul4 Smartbridge Alerts
I too am receiving the "entry point not found" message. I have very little technical knowledge and would appreciate assistance in any fashion. thanks. Helen McLaughlin What is the exact error message you are seeing Which entry-point is not being found This much more likely to an issue with SmartBridge then it is with Windows. Andy I have the same situtaion IE 7(not beta) SBC DSL provider. Smartbridge motivesb.exe psapi.dll error right after startup How did you indentify the correct file Thanks Larry I too am receiving the "entry point not found" message. I have very little technical knowledge and would appreciate assistance in any fashion. thanks. Xavier Gon ...Show All
encoded Help! Link error: "unresolved external symbol"
Hello all, I'm using STL in vc console and got stuck on a simple program. Here is the .h file #ifndef SimplePropertySet_hpp #define SimplePropertySet_hpp template <class N, class V> class SimplePropertySet { private: N nam; V value; public: // Constructors and destructor SimplePropertySet(); // Default constructor SimplePropertySet(const SimplePropertySet<N,V>& source); // Copy constructor virtual ~SimplePropertySet(); // Destructor }; #endif // SimplePropertySet_hpp And the corresponding .cpp file #ifndef SimplePropertySet_CPP #define SimplePropertySet_CPP #include "SimplePropertySet.hpp" template <class N, class V> SimplePropertySet<N,V>::SimplePropertySet() { // Defa ...Show All
Jarodtweiss Calling C# from unmanaged C++
I've been searching a bit and I'm just getting twisted around about what I need to do here. Apologies if this has been answered many times, but I haven't been able to find it. I have a C# class library containing a form called DisplayWindow. It is being built succesfully. Now, I'd like to be able to call my DisplayWindow form to load from some C++ code. Once loaded, I'll be making additional calls into the DisplayWindow from C++. I've seen some examples using COM, but that doesn't look quite like what I want to do. Also, I've seen some stuff for calling C++ from C#, and that looks much easier... Can anyone help with this Thanks! I had to let this project go... I was able to get Java calls through JNI up and running in about an hour ...Show All
PugV CArray quick find
Hi, I've a little problem. I've a very big CArray of my element. I need to find an element many times during that the application runs. This element it's not the same every times so I don't know where the item is. How can I make an implementation that can find what I want as fast as possible Option 1: If your list isn't sorted, you'll have to do a O(N) search through all elements. Option 2: Quicksort the list and do a binary (or similar) search. Option 3: Keep the list sorted at all time, by doing binary inserts and then binary searches to look for items. You should also be able to use a hash-based multi-set (an oxymoron, but basically, just a hash which keeps track of how many of a parti ...Show All
Thomas S. Andersen MFC8
hi i am programming with vc++ express and i have MFC4 and i am looking to upgrad to MFC8 .is that possible and how No, VC++ express does not allow using MFC. You have to use VC++ Standard or above. -- SvenC Search for WTL (Windows Template Library). It is a free download - I think on sourceforge. You should find a bit of documentation and samples on there too. Some guys at ww.codeproject.com have also some samples, tutorials or enhencements. -- SvenC WTL requires the ATL headers so that's not an alternative. The designated GUI framework for the Express editions is Windows Forms. You'll have a pretty steep learning curve, ge ...Show All
NRJ HELP! Enigmatic LNK2005 error defies solution in C++ project
Hello, I am getting the following error on attempting a release build. The Debug build compiles AOK. Error 1 error LNK2005: ___@@_PchSym_@00@UwlxfnvmghLzmwLhvggrmthUxxUnbLwlxfnvmghUerhfzoLhgfwrlLCAAFUkilqvxghUghwkkPehUghwkkPehUivovzhvUwzgzvovnvmgOlyq @ already defined in dataelement.obj dataset.obj I have dealt with LNK2005 errors before, but normally the text of the error is more helpful. How do I decode this so I can find the error I went through all the project setting differences between the release and debug builds, changing the release setttings to match one by one. It did not help. I hand searched my code for the usual LNK2005 suspects to no avail. I was getting stdafx.h not included errors which I solved by adding ...Show All
AlexKL when I run the example from MSDN, it crashed, why?//thanks
// omp_get_num_threads.cpp // compile with: /openmp #include <stdio.h> #include <omp.h> int main() { omp_set_num_threads(4); printf_s("%d\n", omp_get_num_threads( )); #pragma omp parallel #pragma omp master { printf_s("%d\n", omp_get_num_threads( )); } printf_s("%d\n", omp_get_num_threads( )); #pragma omp parallel num_threads(3) #pragma omp master { printf_s("%d\n", omp_get_num_threads( )); } printf_s("%d\n", omp_get_num_threads( )); } Hello Re: when I run the example from MSDN, it crashed, why //thanks Need some more inf ...Show All
arcoant Question on including header files to project in VC++
The question might sound dilly but couldnt find a proper answer. I created a new project in VC++ 6.0 and included an existing header file into it but when I try to use it in a cpp file (also in the same project), I still have to include the header file specifying its exact location. I thought if i add the header file to the project, i can just write # include "xxx.h" in my cpp file and the header file would be automatically found. Instead I am having to write the path of the header file in the include. Am I missing something Thanks, KarthikR If the file you mentioned(header) is in same folder as cpp you want to include this header in, then # include "xxx.h" will work. xxx.h must ...Show All
