Answer Questions
SydIlBradipo unexpected arithmetic results, can someone explain please?
I'd appreciate someone helping me out on this simple question. 5 / 9 * (c-32); results in 0 (c-32) * 5 / 9 ; results in the expected answer Is this the expected behavior in C++ If so, would you point me to the explanation I'm currently working through Robert LaFore's C++ book and haven't run across an answer for it there. I'm using Visual Studio 2005 Pro V. 8.0.50727.42 and .NET V. 2.0.50727 Jeffrey Everett AFAIK it is the expected behavior because * and / operator have an associativity from left to right. So in the first expression x = 5 / 9 * ( c -32); // results in 0 the 5/9 expression will be evaluated first then (c-32) after that the result will be multiplied to and ...Show All
aaks Events
I have tried learning events from the msdn help with out success, I understand the general concept behind events, aswell as how to suscribe to them ' += ' but that's about it Here is what I want to do: declare an event in MyClass1 trigger this event in MyClass2 Finally I want to suscribe to the event in MyClass3 FYI: I am working with managed code Help would be greatly appreciated thanks, the code worked perfect Check this: ref class C1 { public: event EventHandler^ MyEvent; void OnMyEvent(Object^ sender, EventArgs^ e) { MyEvent(sender, e); } }; ref class C2 { public: void TriggerEvent(C1^ c1) { c1->On ...Show All
Chris Honcoop error LNK2019: unresolved external symbol
Hello, I have been learning C++ just for a month. I tried to write a code which uses an external xmlParser. My code is: #include "stdafx.h" #include <vector> #include <windows.h> #include <malloc.h> #include <string> #include <iostream> #include <stdlib.h> #include "xmlParser.h" #include <fstream> //The matrix is defined, it is max 1000*1000 #define MAX_COLS 1000 #define MAX_ROWS 1000 using namespace std; // In the firts part of the program the main data structure are build. Those are interview, person, union. An interview consists of many // persons and unions. struct Union { int partners[3]; int nPartners; int offsprings[10];   ...Show All
Mansoor Ali LNK2028/LNK2019 Errors related to using unmanaged DLL in managed code
Hello, First of all, please forgive me if I am using some terms in an incorrect manner/context. I am reasonably familiar with C++, but relatively new to the managed/unmanaged paradigm. I am writing a managed C++ windows form application using Visual C++ Express Edition (that uses MFC) which, for its core functionality, uses a DLL provided by a third party. I do not have the source code, merely the DLL, LIB, and header. I believe the DLL actually provides C functions, but I am not certain. I have been able to use the DLL without problem up until recently. I have compiled and run earlier versions of the application and used the functionality provided by the DLL with no observable problems. However, recently I have added some code where I ...Show All
Kidsauth green dot instead of blank space
Hi! I have accidentaly pressed something, and now I have this green dot instead of space. It must be a shortcut on the keyboard, can anyone help Thank you and have a nice day! Go to the Edit menu, Advanced, toggle View White Space. Or Ctrl-R,Ctrl-W ...Show All
Santosh Ransubhe Private access
Say if we ve certain private methods along with private data members and public methods. other than friend function is thr any other way we access these members(they being private only) directly. its one of the requirements in a project of mine. The real prob comes when accessing function. say we've classes ported to us in .obj format. then going for DMA using pointers is a risky n unreliable job. class x { private: void meth1 ( ) { cout<< "Meth1" ; } void meth2 ( ) { cout<< "meth 2" ; } } ; class xduplicate { public: void virtual meth1 ( ) ; void virtual meth2 ( ) ; } ; main ( ) { x obj; xduplicate *obj1; obj1= ( xduplicate * ) &obj; obj1->meth1 ( ) ; ...Show All
Slamowitz DLL questions with Visual Studio using C++
I'm new to Visual Studio (I have VS 2005 Standard Edition) and I'm trying to learn how to code a DLL with some standard functions I use instead of including a cpp file into every project that needs it. Using the help I got a DLL to work with a Win32 project using __declspec ( dllexport ) and __declspec ( dllimport ). When I try a Windows Form Application I get lots of errors with the linker because of the CLR from what I can tell. I tried various things I read and could never get it to work. I decided to try my hand at a .def file and after reading up on how you write it up I have some questions. Can you export overloaded functions using a .def file From what I read I have to include extern "C" to keep C++ name mangling from ...Show All
rnadella static const array of CString
Hi, I've a problem with an initialization. I would like to have in my class an array like this: static const CString rgszColumns[26]; And I would like to initialize it in my costructor: Myclass::Myclass() { const rgszColumns[] = { "aaa", "bbb", "ccc" ....}; } why this code doesn't works Viorel. wrote: What kind of errors are you receiving The following sample should work: Myclass.h file class Myclass { public: static const CString rgszColumns[]; }; Myclass.cpp file const CString Myclass::rgszColumns[] = { _T("aaa"), _T("bbb"), _T("ccc") ...Show All
92869 16-bit programs on Windows Server 2003 (probably ActiveX problem)
I have a program that was written for in C++ for Windows 3.x and runs fine on every Windows OS up until XP. On Windows Server 2003 some user-interface-elements are missing. I was given source code that uses GUI-classes called TDialog, TCheckBox etc.and includes files called dialog.h and checkbox.h. Those files are missing though. A directory of the source code has these components and dlls: - comdlg16.ocx - compobj.dll - msoutl16.ocx - oc25.dll - ole2.dll - ole2disp.dll - ole2nls.dll - ssdock16.ocx - sstabs16.ocx - storage.dll - tabctl16.ocx - threed16.ocx - typelib.dll - vb40016.dll - vshare.386 These components are not installed during the installing process for some reason. I installed the Visual Basic 4 runtime an ...Show All
AFTIadmin Assertion Failed Microsoft Visual C+++
Whenever I go int my computer and then click the C:\ it opens up but seconds later I get an error. Microsoft Visual C++ Runtime Library. Program: C:\Windows\Explorer.EXE File:../external/boost_1_31_0\boost/share_ptr.hpp Line:254 Expression: px != 0 For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts (press Retrey to debug the application - JIT must be enabled) Abort Retry Ignore. I have windows xp Media center edition XP2. Its a sony vaio. I've tried uninstalling previous programs that may have caused the problem but nothing works thus far. Please help. I seriously doubt that Explorer uses Bo ...Show All
mrhoads problem moving from managed extensions to C++ 2005
Can some one help me migrate the following code from managed extensions to C++ 2005 #using <mscorlib.dll> using namespace System; namespace Test { public __gc class TestClass { public: void SendByRef(String __gc* __gc* test) //MC++ an instance to a class is always a pointer, in this case it's pointer to ref which is a pointer. { (*test) = new String(S"testing 123"); } }; } C# code will be: ============== Test.TestClass t = new TestClass(); string strTest = ""; t.SendByRef(ref strTest); Answer given at gotdotnet is as follows: using namespace System; namespace Test { public ref class TestClass { public: void SendByRef(String^ %test) { test ...Show All
dr.xaml Custom Dll with MFC linked
Hello people! Now i have this tricky task: I would like to create a regular dll, but with MFC statically linked and initialized, to use the MFC classes. BUT the MFC library provides it's own DllMain. How can i override the MFC's DllMain, while still linked to MFC The reason i want to do that is that CWinApp doesn't give me an opportunity to handle the THREAD_ATTACH and THREAD_DETACH events. I think you should try the following approach. In your regular DLL, declare your own main function which calls the default one: extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID p); extern "C" BOOL WINAPI MyDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID p) { ...Show All
OldCDude C++ in visual
I have just started using visual and my codes don't work. DO i have to change some setting or what's wrong. #include <iostream.h> main() { int a; int b = 20; int c = A + B; cout << "ENTER A VALUE FOR 'A' : "; cin >> a; cout << "Here is the ANSWER when u add 20 to ur varible: " << c ; return 0; } from your Code it looks you forget to use namespace .namespace is just a declerative region of your code.when you use cout and cin you have to tell to your compiler where this is located so here is one approach #include<iostream> int main() { std::cout<<"hello"; return 0; } Second is approach #inc ...Show All
ishaywei 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 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 Gonzalez I was getting the same error message after I installed IE7. The above link gave a fix which worked. The only difficulty I had was in finding the correct file. I did a search for Smartbridge from the Start menu in Windows and it pointed me to some program files to do with my ISP. Did as link said and all now works ok. Many thanks, Andy. ...Show All
BlakeMc Creating a library
In VS2005, I would like to create a C++/CLI library, such that, it could be reused by other C++/CLI projects. 1. Do I create the library as a ".lib" file If not, what are my options 2. Is it possible to share that library to a VB.NET (in VS2005) project If so, what type of output file should I be creating VC++ 8.0 contains CStringT template in atlstr.h which doesn't require MFC. CString is defined as CStringT<wchar_t> in Unicode build and CStringT<char> in non-Unicode build. So, CString is available without MFC. Generally, there is no need to use MFC in C++/CLI. .NET Framework contains all required functionality. In the C++/CLI class libra ...Show All
