|
I am having issues writing a C++ .dll.
When using MSVC++ 2003 the following line;
#include <iostream>
gives me a few errors
OraclePingC++ error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
and
OraclePingC++ error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
When I comment out the #include line, the errors go away. I've tried to play with the linker settings with my properties, but I'm not making progres..
|
|
|
|
|
JaeBeam wrote: When I comment out the #include line, the errors go away.
So then what's the problem?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
DavidCrow wrote: So then what's the problem?
It is "not working".
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: It is "not working".
It's not working, plz send me codez, urgentz plz plz.
FFY
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Now I understand. The low vote is because I missed the important information.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
This is just supposition, but did you do this in debug mode? I see that it's trying to call malloc and free with debug mode... try in release. see what happens. but i've definitely never seen this happen before
|
|
|
|
|
In your compiler settings look for the C/C++ Code generation section and change the Runtime library to Multi-Threaded-Debug /MTd
Best Wishes,
-David Delaune
|
|
|
|
|
It appears I already have my my Runtime library to Multi-Threaded-Debug (/MTd)
Here is the complete command line, cut and pasted from my projects properties:
/Od /AI "D:\Source Code\Cardacc v5.0.xx Customs\OracleTest\OraclePingC++\Debug" /D "WIN32" /D "_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"stdafx.h" /Fp"Debug/OraclePingC++.pch" /Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Zi /clr /TP /FU "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /FU "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
When I try to build the dll in Release mode, I receive a ton of LNK2001 and 2019 errors.
|
|
|
|
|
JaeBeam wrote: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll
Is your project suppose to be using Managed C++ because you have the /clr flag set.
Best Wishes,
-David Delaune
|
|
|
|
|
Sometime the order that you #include header files will cause stuff like this to happen because one header expects another to be included first. Try changing the order of your #include s.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I used the class to obtain values that an installer package saved to the registry. I can see the values in Regedit. but when the CRegistry class (readline()) never reads them!
I really need a solution to this: here's my code:
// App command to run the dialog
void CShopApp::FindRegData()
{
CRegistry Reg();
CRegData m_cRegData;// class of 5 CStrings
m_cRegData.CleanUp();
//CRegistry Reg;
CString csSubRoot = "SOFTWARE\\Mills Software Solutions Inc\\Shop";
m_cRegData.m_csRootMainKey = "HKEY_LOCAL_MACHINE";
m_cRegData.m_csSubKey = csSubRoot;
Reg.SetRootKey(HKEY_LOCAL_MACHINE);
if (Reg.SetKey(csSubRoot, FALSE))// jumps out here
{
m_cRegData.m_csCompany = Reg.ReadString("Company", "");// all CStrings in class m_cRegData are
"bad pointer" errors
m_cRegData.m_csUser = Reg.ReadString("Name", "");
m_cRegData.m_csSerialCode = Reg.ReadString("Serial", "");
m_cRegData.m_csRegCode = Reg.ReadString("RegCode", "");
//Reg
}
else
{
TRACE("Failed to open key\n");
}
m_csSaveData = InsertDelimiterReg(m_cRegData);// all CStrings Bad pointer
FileSaveRegData();
}
Can someone please explain why this is happening? I used REGEDIT and found that the key and values are there! I just can't get CRegistry to retrieve them.
Help!
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: I used the class...
This one?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I found the culprit. ERROR_ACCESS_DENIED (Error # 5). How do I tell my program to "Run As Administrator" PROGRAMMATICALLY, without the User having to do anything IN MFC!
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: How do I tell my program to "Run As Administrator" PROGRAMMATICALLY, without the User having to do anything...
Have you looked at AdjustTokenPrivileges() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Old Thread, but I had the same problem with CRegistry class in Windows 7. But my compiled Program didn`t have the problem, so I just activated the "Run as Administrator" option for my Visual Studio, and CRegistry could read the Registry Keys...
|
|
|
|
|
My object is to find the size of the text file without traversing the characters. I wrote the following code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
main()
{
int lno=1,n=0,x=2;
long position=0;
char ch[1000],s[1000];
FILE*fp;
fp=fopen("imp.txt","r");
if (fp==NULL)
{puts("Cannot open file");
exit(1);}
printf("01 ");
while(1)
{
ch[n]=fgetc(fp);
n=n+1;
if (ch[n-1]==EOF)
break;
if (ch[n-1]=='\n')
{printf("\n0%d ",x);
x=x+1;}
else if (ch[n-1]!='\r')
{
printf("%c",ch[n-1]);}
else if (ch[n-1]=='\r')
{continue;}
}
fseek(fp,0,SEEK_END);
position=ftell(fp);
printf("\n\n Size of the text file is %ld bytes\n ",position);
fclose(fp);
}
FILE DATA:
Hello
Roger here
Keep it up
Please reply
The size given by this code is 43 bytes while what i am getting on my windows is 638 bytes. Is this right? If yes then Why?
|
|
|
|
|
Suggestion: Please select your code and click on codeblock while you are posting big code snippets.
please edit it atleast now.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Razanust wrote: FILE*fp;
fp=fopen("imp.txt","r");
Razanust wrote: fseek(fp,0,SEEK_END);
position=ftell(fp);
That is all that is needed to get the size of the file.
Or you can use the CreateFile[^] and GetFileSize[^] APIs.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
hai all,
in one of my applications, i have to automate a dos level command.
so i construct the command into an str and execute it using system(str).
but in this case, the console window is getting flashed while the command is being executed.
could any one suggest any other alternative to avoid the display of console.
thanks in advance.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hello,
Is it a Windowed application or a console application? Which dos level command are you executing?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
my application is windowed.
actually, there are some Third party command mode tools which should be used in a sequence to perform some operations on wav files and text ifles.
so i wanted to automate them using a single button click.
and each of those tools print some output also, and i have to process and display that output also.
as of now, iam achieving that by redirecting the output to a text file and reading it back.
i would be pleased if you can suggest any easier method also.
bu my immediate problem is to hide or suppress the console window.
if my questin is not clear please let me know. i will try to explain it better.
thank you.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
Rajesh R Subramanian wrote: So, you are not working with any DOS commands.
no the sequence of command which i was talking about may also have them.
Yes, i tried to use the create process. but..
CString str;
str.Format("copy database\\*.* %s>>c:\\output.txt",tempfolder);
DeleteFile("output.txt");
STARTUPINFO s;
s.wShowWindow=STARTF_USESHOWWINDOW&&SW_SHOW ;
int ret=CreateProcess(str.GetBuffer(str.GetLength()),NULL,NULL,NULL,NULL,NULL,NULL,NULL,&s,NULL);
there is no result.
what is the mistake here.
|
|
|
|
|
chandu004 wrote: STARTUPINFO s;
s.wShowWindow=STARTF_USESHOWWINDOW&&SW_SHOW ;
s.dwFlags = STARTF_USESHOWWINDOW;
s.wShowWindow = SW_SHOW;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
no difference still
iam using it this way.
STARTUPINFO s;
s.dwFlags=STARTF_USESHOWWINDOW;
s.wShowWindow=SW_SHOW ;
int ret=CreateProcess(str,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&s,NULL);
here, str contains the command to be executed.
which is working perfectly when i use it with system().
what is the mistake here?
|
|
|
|