|
I really don't know how to interpret this:
error C2598: linkage specification must be at global scope , when I click on it it takes me to this function, I will bold the text where the arrow points to. I'm lost......again.
void Create_Report(Diver_Info theDivers[])
{
ofstream OutputFile;
OutputFile.open(ReportFile, ios::out);
OutputFile << setiosflags(ios::fixed|ios::showpoint) << setprecision(2);
OutputFile << setiosflags(ios::left) << setw(6) << "Place" << setw(26) << "Name"
<< setw(8) << "Score" << endl << endl;
for(int i = 0; i < Best_Divers; i++)
{
OutputFile << setw(6) << (i + 1) << setw(26) << theDivers[i].Diver_Name
<< setw(8) << theDivers[i].Total_Score << endl;
}
OutputFile.close();
}
My header file that I am including does #include <fstream.h>. Any ideas?
Nick Parker
|
|
|
|
|
Compiler Error C2598
linkage specification must be at global scope
The linkage specifier was declared at local scope.
The following is an example of this error:
void func()
{
extern "C" int func2(); // error, linkage declared in
. // block at local scope
.
.
}
extern "C" int func( int i ); // OK
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Right, well I read that at MSDN too, however it doesn't mean anything to me. Could you explain. I am just trying to create a file stream to write an output file. What else do I need?
Nick Parker
|
|
|
|
|
if u copy paste ur function into a console application does it work? if it doesnt, u declared a function in a scope of another
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hmmm... I'm pretty sure I understand what you are saying, however after looking through this I don't see where I have done that. Maybe I need to go strech my legs.
Nick Parker
|
|
|
|
|
Make sure you are not mixing IO.
try to use <fstream>
|
|
|
|
|
if i copy your code into an empty app and add the appropriate headers (and a fake DriverInfo struct), it compiles fine.
#include "stdafx.h"
#include <iomanip.h>
#include <fstream.h>
struct Diver_Info
{
char Diver_Name[26];
int Total_Score;
};
void Create_Report(Diver_Info theDivers[])
{
int Best_Divers = 0;
ofstream OutputFile;
OutputFile.open("c:\\temp\\ofs.txt", ios::out);
OutputFile << setiosflags(ios::fixed|ios::showpoint) << setprecision(2);
OutputFile << setiosflags(ios::left) << setw(6) << "Place" << setw(26) << "Name" << setw(8) << "Score" << endl << endl;
for(int i = 0; i < Best_Divers; i++)
{
OutputFile << setw(6) << (i + 1) << setw(26) << theDivers[i].Diver_Name << setw(8) << theDivers[i].Total_Score << endl;
}
OutputFile.close();
}
int main(int argc, char* argv[])
{
Diver_Info d[2];
Create_Report(d);
printf("Hello World!\n");
return 0;
}
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
That does seem to surprise me, nothing seems to surprise me anymore
I am not sure what is going on, it appears to be correct, but the compiler just spits it back at me. I am sure I am doing something wrong here somewhere.
Nick Parker
|
|
|
|
|
If you leave off a ; on a class declaration you can end up with very confusing error messages
class MyClass
{
} <--- oops!
And there's very little that will pin-point the actual errors. In cases like these you just have to try changing/removing things until you can narrow down the actual error.
Todd Smith
|
|
|
|
|
Are you including the right fstream header somewhere else ? fstream.h is not standard, you should include fstream instead. The same goes for all other iostream headers such as iosfwd and so on.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Having worked in Boreland Builder for GUI the last 4 years, was forced to use VS and MFC to do a rather complicated GUI. I simply can not believe it is as painful as it seems.
The some of the GUI libs on here are very nice, but on the whole the work has to be a factor more.
Are there any benefits to using VS and MFC over an actual RAD enviroment?
|
|
|
|
|
Anonymous wrote:
Are there any benefits to using VS and MFC over an actual RAD enviroment?
MFC looks good on your resume.
-c
Aiei i ea eio aoa i e eio e aigoa
|
|
|
|
|
Hi,
Yeah, it definitely looks good on your resume and is a must-have. However, having said that I am not a big fan of MFC myself. It really bloats up the software and makes it sluggish. However, companies use it and you are left with no choice. In my personal projects, I make wrapper classes around the WIN API.
Relisoftis a good resource if you want to learn about programming for windows without the use of MFC. Even if you use MFC, it is a site worth looking at. I am not saying, do not use MFC at all. But it sure is a good learning experience, if you know your way around WIN32 API.
My 2 cents
Pankaj
Without struggle, there is no progress
|
|
|
|
|
VS and MFC aren't exactly the best RAD tools available, but I find they have more power and flexibility than Borlands offerings. It depends on what you are trying to develop. MFC is great for building large applications, but you do need to know how and why things work in it.
I love MFC, but it is starting to show its age but for nearly 10 years it has allowed me to develop lots of Windows applications quickly (if not always easily)
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Hello, where do I get my hour/minute from the computer?
CString mydate;
mydate.Format("%d:%d", xxx );
|
|
|
|
|
Assuming you can use native Win32, see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/time_functions.asp
Not sure how MFC does things.
|
|
|
|
|
Check CTime::Format and COleDateTime::Format.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
|
one class :
CTime
usefull member function: Format
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Using MFC, you could use the CTime class.
Kuphryn
|
|
|
|
|
|
Hello and thanks in advance for your help.
I've got an app that's been released into production for a couple years now. Recently I've had reports of an IPF occurring at 01F:004013AB. I have not been able to reproduce this error in my testing environment.
I have tried to set a breakpoint at this memory address, but the IDE shows an error. I've noticed a few things - one is that the memory address maps to different code locations depending on wether I'm running a beta or release version in the IDE. So I've been trying to break at the memory location when in release configuration and checking the disassembly - with no luck. The other thing I've noticed is that this is a very early memory location, seeing that windows loads apps at 00400000.
Does anyone have any insight into this? I'm wondering a few things: is that memory address (004013ab) comparible across OS'es? Is it comparible across machines? Is there a way to figure out what is causing the error without debugging on a machine that is causing the error?
|
|
|
|
|
The adress 0x004000000 is the default base adress in your linker settings. You can (should) change this anyway. I believe there are some articles on MSDN about load adresses of applications that explain the why and how. Basically, windows tries to load you application into this adress space. If there is already another application loaded (most probably is -> default base adress of VC) then it will 'relocate' you application to another adress.
The adress you mentioned 0x004013AB is just 0x13ab bytes into the start of your application (0x00400000). If you take a look at the assembly listing of your app, or set a breakpoint onto this adress (depending on the load adress on your debuggin environment) you will find the spot where the error occurs.
Hope it helps.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
If you subclass a CListCtrl and call it CMyListCtrl and then use the CMyListCtrl as a member variable in a dialog box, some of the messages are caught by the parent dialog and some are sent to the CMyListCtrl. I was wondering if there is a way to direct these to catch these in my actual dialog instead of in my control.
|
|
|
|
|
PreTranslateMessage()
Renjith-CPian.
|
|
|
|