|
That's fine, there's no problem.
Okay - so what does this error message say?
Which file is not being found, or which functions are resulting in 'unresolved externals' type messages.
It sounds mighty like although the files are present in the project directory, they are not actually a part of the project. The IDE/makefile has to get told that they exist and to use them.
I.e - I notice that you have a number of .H files. Are their corresponding .cpp/.lib files included in the project - either via the project properties pane (.cpp) or the linker dependencies window (.lib files)
But for starters, what is the error message you recieve (please, cut and paste it - don't approximate or summarize it)
|
|
|
|
|
the .h files have all the code on them so it shouldn't be that.
here's the exact error message-
1>test.obj : error LNK2019: unresolved external symbol "class graphType<int,11> __cdecl cGraph1(void)" (?cGraph1@@YA?AV?$graphType@H$0L@@@XZ) referenced in function _main
1>J:\o\test1\test\Debug\test.exe : fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
Hmm. I must confess to having spent _very_ little time with templates. I'm afraid I can't help any further with this - I don't know enought to know.
|
|
|
|
|
its cool
thanks for trying
|
|
|
|
|
You didn't provide a body for your constructor and destructor of the GraphType class. Add { } after the constructor/destructor declarations.
Furthermore, remove the paranthesis after the cGraph1:
graphType<int,11> cGraph1;
|
|
|
|
|
Hi All,
I am using atof in my code and i have some problem in conversion.
CString samount = "32.33"
double damount = atof(amount);
float famount = atof(amount);
if i debug and check damount and famount, they have following values
damount has 32.3299999
famount has 32.330002
the damount is used in many calculations and i am thinking those calculations will resulat wrong.
Did some one know how i can make sure to returan the correct double value from a string.
or Are there any libraries that i need to use to get the correct value.
Thanks.
|
|
|
|
|
Well, double has more precision than float and that is what you're seeing most likely. Most values can't be represented exactly in either float or double so the approximate values will vary if you compare directly. For this reason, you can almost never reliably compare floating point values for equality. In fact, as you're seeing, you probably need to be careful about inequalities when the values being compared are "close". You always need compare using an "epsilon" value, a small value indicating "close enough". Similarly, you need to be careful the ordering of calculations if the values vary wildly in range. For instance, subtracting a small value from a large one may result in no change at all.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
|
I am trying to make an INI file in
C:\Documents and Settings\All Users\Application Data\MyApp
I know WritePrivateProfileString will write a new file if one does not exist, but if I try
#define INI_FILENAME "C:\\Documents and Settings\\All Users\\Application Data\\MyApp\\MyApp.ini"
WritePrivateProfileString("My Section", "My Name", "My Value", INI_FILENAME);
It will only make a new ini file if the directory exists.
Is there a workaround for this? If not, how do I check to see if a directory exists, and make a new one?
|
|
|
|
|
malaugh wrote: how do I check to see if a directory exists, and make a new one?
SHCreateDirectoryEx
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
SHCreateDirectory can create the full path with just one call.
|
|
|
|
|
the window sdk's function to operation "*.ini", like function WritePrivateProfileString and more,it's very inconvenient.
so you can use this class in your program (if the section isn't exiting,it will create himself.)
#if !defined(AFX_OPINI_H__CE3F8B7B_1ACA_46CC_A91C_F8E23FA9B063__INCLUDED_)
#define AFX_OPINI_H__CE3F8B7B_1ACA_46CC_A91C_F8E23FA9B063__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afxwin.h>
class COPini
{
public:
static DWORD ReadString (char *section, char * key, char stringtoread[], char * filename);
static BOOL WriteString(LPCTSTR section, LPCTSTR key,char* stringtoadd, char *filename);
COPini();
virtual ~COPini();
};
#endif // !defined(AFX_OPINI_H__CE3F8B7B_1ACA_46CC_A91C_F8E23FA9B063__INCLUDED_)
#include "stdafx.h"
#include "OPini.h"
COPini::COPini()
{
}
COPini::~COPini()
{
}
void error(LPSTR lpszFunction)
{
CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "%s failed: GetLastError returned %u\n",
lpszFunction, dw);
MessageBox(NULL, szBuf, "Error", MB_OK);
ExitProcess(dw);
}
BOOL COPini::WriteString(LPCTSTR section, LPCTSTR key, char *stringtoadd, char *filename)
{
CHAR FilePath[255];
GetModuleFileName(NULL,FilePath,255);
(strrchr(FilePath,'\\'))[1] = 0;
strcat(FilePath,filename);
return ::WritePrivateProfileString(section,key,stringtoadd,FilePath);
}
DWORD COPini::ReadString(char *section, char * key, char stringtoread[], char * filename)
{
CHAR FilePath[255];
GetModuleFileName(NULL,FilePath,255);
(strrchr(FilePath,'\\'))[1] = 0;
strcat(FilePath,filename);
return ::GetPrivateProfileString(section, key,NULL,stringtoread,255,FilePath);
}
you can it like this:
#include <<OPini.h>>
int main()
{
char *p1 = "Hello";
char *p2 ;
COPini::WriteString("Section1", "KeyName1", p1, "SetInfo.ini");
COPini::ReadString("Section2" , "KeyName2", p2, "SetInfo.ini");
.....
}
Good Luck !
modified on Tuesday, May 4, 2010 6:29 AM
|
|
|
|
|
How does this help to create a non-existent folder structure? I think that SHCreateDirectoryEx() would be a better choice.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I have some code that is not getting executed in release mode. The code is in appui3.cpp in microsofts library. The method is GetProfileInt. I am trying to read some prefereces from the registry. It is working in debug mode, but in release it doesn't seem to be going to the method therefore I am not getting expected data. I am compiling with the /ZI switch for debug info in release mode also. Using VS2008. Any ideas?
Thanks
Ray
|
|
|
|
|
You could try by disabling optimizations.
For reading data from the registry use the registry functions instead.
|
|
|
|
|
Yes I have disabled the optimization. Thanks for the input, but why is it still not executing this part of the code?
Ray
|
|
|
|
|
Ok, I have decided that the code is getting executed, its just that when I step through in release mode it doesn't show me the actual steps it is taking nor are the value of the variables in the debugger valid.
So back to my problem that prompted this message. My program gets an exception in release mode but not in debug, but if I can't step through the program or rely on the debug variables in release mode, then how do I find out what is causing the exception? I've turning on the debugging information /Zi, turned off optimization, and turned on generate debug info in the linker. Still can get no usefull info from the debugger in release mode. Any ideas?
Ray
|
|
|
|
|
Step through the code and see...
Steve
|
|
|
|
|
Since you have the source code, you can make a backup of it and then modify this file to help you debug. Use OutputDebugString() and the free dbgview from sysinternals.com (now MS). This works for release mode build.
|
|
|
|
|
My problem is that it never goes to this code in release mode. I've put a break point on it and it never hits it.
|
|
|
|
|
Ok, I have decided that the code is getting executed, its just that when I step through in release mode it doesn't show me the actual steps it is taking nor are the value of the variables in the debugger valid.
So back to my problem that prompted this message. My program gets an exception in release mode but not in debug, but if I can't step through the program or rely on the debug variables in release mode, then how do I find out what is causing the exception? Anyone???
Ray
|
|
|
|
|
So during install I'd like to be able to determine the FTP root directory.
Anyone know how??
Thanks!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Install of what? Root directory of what FTP? Where? I think you should provide much more information than that to get a usefull answer. Try explaining a bit what you want (i recommend editing your original post), good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
The problem is figuring out what the root directory of the FTP server is on a machine. Of course how to ensure FTP is installed and running would probably be a bonus question!!
I'm just giving a peek into what I'm working on when speaking of an installer. The installer isn't the problem.
Thanks..
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
I think finding that out isn't so trivial...i mean, there are probably tonns of FTP server softwares out there, each of them storing its root folder setting differently, in the registry, in some ini file, and so on... your best bet would be to make a connection to the FTP server but i don't know if the FTP protocol can tell you where the root folder is located on the local system. Also, as far as i know there might be different FTP root folders depending on the user who logs onto the server, so which one of the users would you want to use? I don't know much about installers, i hope someone else will give you a better answer.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|