|
Thanks for your reply!
How could I track down the problem of function declaration?
Do you mean by "3rd party lib" the GSL Package?
If so: yes, this should work with C++.
Strangely enough, the whole thing actually works when I
compile with DEV-C++.
Cheers Lebesgue
|
|
|
|
|
Although this is a very old question it may still be of interest. I have just been running GSL (1.8) in Visual Studio 2005, and had much the same problem with unrecognised symbols, even though I could see they were in the Libs, libgsl_dll_d.lib, libgslcblas_dll_d.lib. In my case I was using the Hybrid and Newton root finding algorithms. The symbol that was missing was gsl_multiroot_fdfsolver_gnewton.
Eventually I found that I had to add GSL_DLL to the Property Page: Configuration Properties: C/C++: Preprocessor, Preprocessor Definitions.
That surprised me, but clearly it is the way to link up with the GSL code.
Raymond Mercier
|
|
|
|
|
Can someone tell me why I can't get my output lined up.
#include <iostream><br />
#include <cmath><br />
#include <iomanip><br />
using namespace std;<br />
<br />
int main(void)<br />
{<br />
double l;<br />
double arate;<br />
int n;<br />
<br />
cout << " Enter the loan amount: ";<br />
cin >> l;<br />
cout << " Enter annual interest rate: ";<br />
cin >> arate;<br />
cout << "Enter total number of payments:";<br />
cin >> n;<br />
cout<< endl<< endl;<br />
double mrate = (arate /12 ) / 100 ;<br />
<br />
double numerator= pow(1 + mrate , n)* mrate;<br />
double denominator= pow(1 + mrate , n) - 1;<br />
double mpayment = (numerator / denominator) * l;<br />
double apb=mpayment * 36;<br />
double ip=apb-l;<br />
int mi= arate/12;<br />
<br />
cout << setiosflags (ios_base::internal)<<"Loan amount:"<< setw(30)<< setprecision(2)<< fixed<< "$" << l << endl;<br />
cout << "Monthly interest rate:"<< setw(30)<< mi << "%" << endl;<br />
cout << "Number of payments:"<< setw(30)<< n << endl;<br />
cout << "Monthly payment:"<< setw(30)<< "$"<< mpayment << endl;<br />
cout << "Amount paid back:" << setw(30)<< "$"<< apb << endl;<br />
cout << "Interest paid:"<< setw(30)<<"$"<< ip << endl; <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
return 0;<br />
}
BINARY
|
|
|
|
|
Binary0110 wrote: Can someone tell me why I can't get my output lined up.
what do you mean by "lined up" output?
-prakash
|
|
|
|
|
As Mr.Prakash says, what do you mean by "can't get my output lined up"? Include a sample of the output of your program, showing the problem (AND MAYBE AN EXAMPLE OF WHAT YOU WANT.)
My approach would be to use sprintf() function, to generate a string with the right formatting before using cout() , but that is just because I am happier with C-style printf() and its parameters than the weird new-wave C++ approach (using cout() and setw() etc.)
|
|
|
|
|
What do I have to do if I want to use some var with the type LPCWSTR in my program. The only time I made it work is when I included windows.h 2 time by error.
|
|
|
|
|
I am not sure about anyone else, but your question does not make any sense to me. It might help if you tried to explain what you are trying to do.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
-- modified at 16:15 Tuesday 1st November, 2005
|
|
|
|
|
I'll explain it better:
I want to declare a variable of type LPCWSTR like this:
LPCWSTR lpInfo;
but I always get an error when I do this
The error: error C2065: 'LPCWSTR' : undeclared identifier
Now the question is : What do I have to do to make this error go away. Do I have to include something or ... ?
|
|
|
|
|
Ah... now that makes a bit more sense. Have you tried changing your project to UNICODE? The 'W' means wide character.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
and how do I change my program to unicode?
|
|
|
|
|
If you are using Visual Studio .NET 2003 then go to Project->Properties. Under the Configuration Properties->General heading, change the Character set option to use UNICODE.
If you are not using VS .NET 2003, I don't know that I can answer your question.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
It(LPCWSTR) declared in WINNT.h File ?
d
|
|
|
|
|
Wes Aday wrote: Have you tried changing your project to UNICODE? The 'W' means wide character.
Are you sure? I thought defining UNICODE is to convert LPCTSTR to LPCWSTR, but otherwise you can always use LPCWSTR. I have used it like this, may be I included wchar.h?
thanks!
|
|
|
|
|
|
I already read this article, but it doesn't help me with this problem, it only helped me understand how unicode and multibyte works.
And for the previous answer:
It didn't change anything, but I wanted my program to be in Unicode so that helped.
And I found something weird, windows.h was included in the main .cpp of my application, and if I erase it and put it in the stdafx.h, the lpcwstr is working. But I get error with my messageboxes and the getobject function(wich was generated automatically).
Do you understand something about this?
BTW i'm using a .net project. That seems to cause all the errors because if i make a classic win32 application, it's working.
-- modified at 17:16 Tuesday 1st November, 2005
|
|
|
|
|
It seems that there is a bug that occur when you include windows.h (I don't know why this include was put in the .cpp by default, but it wasn't including it correctly)
All I had to do is add
#pragma push_macro("GetObject")
#undef GetObject
#pragma push_macro("MessageBox")
#undef MessageBox
at the start of my code and
#pragma pop_macro("GetObject")
#pragma pop_macro("MessagBox")
at the end to make it work.
|
|
|
|
|
Yahoo installs a start menu item to open “yahoo mail”, the shortcut points to:
C:\WINDOWS\system32\RUNDLL32.EXE C:\PROGRA~1\Yahoo!\Common\ymmapi.dll,OpenURL http://mail.yahoo.com/?.redir=ymmapi11
This seems to run iexplore.exe under svchost.exe under system. Does anyone know how this works? what exactly does rundll32.exe do here? Does the DLL have anything to do with the iexplore.exe opening under svchost.exe?
And, why does yahoo do it this way - any benefits?
thanks!
|
|
|
|
|
rundll32.exe is used to "execute" a dll.
Since dll can not live by itself in the memory,it needs a host so windows provides svchost.exe as host for an "executable" dll which is most likely to be ymmapi.dll
-prakash
|
|
|
|
|
Thank you. Do you know how to implement a DLL of my own that will work this way?
thanks!
|
|
|
|
|
|
I just read John Simmons post about getting his app to compile cleaning at warning level 4.
So, just for kicks I thought I'd try it on a console server app I am currently finishing up. But I get oodles and oodles of warnings from within the STL headers. Is there some other setting you need to use to do this? Is it not possible to have w4 clean code and use STL? This is using VC6 (sp5).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Just as an aside, I've noticed that there is reference to the /Za option, to disable Microsoft language extensions. But if you do this, then you lose the __declspec(__import), and __declspec(__export). Which means, if you do C++, that if you are creating a DLL, you'll need to export the functions by hand through a .def file, right? Isn't that a total nightmare? Does anyone actually do this?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim Crafton wrote: Isn't that a total nightmare? Does anyone actually do this?
it's not really a nightmare. you just put the function names in the .DEF file and compile... i do it all the time.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Right but with a C++ DLL (i.e. exporting a C++ class from the DLL), you can't do that - you have to put the name mangled names right? Plus, at least for my project at home, this could amount to several hundred classes (at least).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim Crafton wrote: Right but with a C++ DLL (i.e. exporting a C++ class from the DLL), you can't do that - you have to put the name mangled names right? Plus, at least for my project at home, this could amount to several hundred classes (at least).
There is a free tool that would automatically export all mangled names into a def file, but I can't remember its name
Anyway, even that is not perfect - you don't want all functions from all classes exported.
[EDIT] I remember now. It is dlltool[^].
[/EDIT]
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-- modified at 21:25 Tuesday 1st November, 2005
|
|
|
|