|
If i have in my class a function. And if i delete all calls to that function, without deliting a function it self, Will that function also compile, or it will be excluded from build
|
|
|
|
|
And if a tree falls in the forest and there's nobody there to hear it, does it make...
Yes.
Try this...
void test()
{
#pragma message( "Compiled on " __TIMESTAMP__ )
}
If it's in a cpp file all by itself and it's never used then it shouldn't get linked.
|
|
|
|
|
Thanks. So i must use precompile directives to exclude it from build
|
|
|
|
|
bsaksida wrote: So i must use precompile directives to exclude it from build
That would work
The compiler has no way of knowing if a function/method is used or not since it compiles on a
per-module (cpp file) basis so I suppose it must assume it's used somewhere else.
Mark
|
|
|
|
|
Hi all,
I am using Kellerman Software which is logging library. actully i have to use this library in console base application using windows 2005(vc++).
in which, whenever i run my application it truncate all the contents of LOG file and shows only current log messages.
what i have to use that it appends the new LOG messages not truncate this file and than add.
if anybody have idea about that please reply me.
thanks
bankey
|
|
|
|
|
I know I don't spend much time in the CP forums talking or maybe even not at all I do allot of browsing here, I recently found a tut from RegistryKey. After adding the code to my project it had said that the namespace did not exist, for example 'Microsoft': class or namespace does not exist. I don't know what to do im completely lost as to where to go from here, I have the most recent as far as i know its recent, SDK 2.0 installed along with VS .NET '03. For this project I am using C++/CLi.
|
|
|
|
|
May be you can post code, that giving error.
|
|
|
|
|
<br />
<br />
#include "stdafx.h"<br />
<br />
using namespace Microsoft::Win32;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
<br />
rkey = Registry.CurrentUser;<br />
rkey1 = rkey.OpenSubKey("Software",true);<br />
<br />
RegistryKey rkey2 = rkey1.CreateSubKey("Tweety");<br />
<br />
rkey2.SetValue("Name","Tweety");<br />
rkey2.SetValue("Age",24);<br />
rkey2.Close();<br />
rkey1.Close();<br />
<br />
return 0;<br />
}<br />
Error Log
Im still learning 
|
|
|
|
|
Oh dear ! you are not using managed C++, I fear.
If you want to use this code in unmanaged c++, go to project properties-->configuration properties-->Project defaults-->common language runtime support and set it to commong language runtime support(/clr) .
Or better of starting new project with type VC++-->CLR-->CLR console application .
|
|
|
|
|
it wasn't giving me that option, although I did notice what you were talking about. so im just removed all of my sdk components and reinstalled my sdk. but also i do want to thank you and you helped allot.
|
|
|
|
|
It would be better, if know what project type you have used for creating this console application, If you had selected VC++-->CLR , error you have mentioned should not come at all. If its VC++-->win32 application , you need to select option I mentioned earlier.
Herboren wrote: i do want to thank you and you helped allot.
Its pleasure to help you.
|
|
|
|
|
case USER_NORMAL:
for each (String ^tempStr in arrTableUsers_NORMAL)
{
if (firstColumn == true)
sql += tempStr;
else
sql += ", "+tempStr;
}
return sql;
break;
case USER_POWER:
If i have enabled for each block in a switch statment, i get errors:
Warning 1 The type initializer for '<Module>' threw an exception. 0 0
Warning 2 The variable 'lstListUsers' is either undeclared or was never assigned. 0 0
Error 3 error C2360: initialization of '$S3' is skipped by 'case' label c:\projects\cddvdorganizer\cddvdorganizer\syntaxBuilder.h 379
can somebody please help, this is me a headaches.
|
|
|
|
|
bsaksida wrote: Error 3 error C2360: initialization of '$S3' is skipped by 'case' label
Modify your code like,
case USER_NORMAL:
{
for each (String ^tempStr in arrTableUsers_NORMAL)
{
if (firstColumn == true)
sql += tempStr;
else
sql += ", "+tempStr;
}
return sql;
}
break;
case USER_POWER:
|
|
|
|
|
Thanks, I woud newer thought about this solution, By the way:
Do you know how to fix the foolowing errors.
Warning 1 The type initializer for '<module>' threw an exception. 0 0
Warning 2 The variable 'lstListUsers' is either undeclared or was never assigned. 0 0
|
|
|
|
|
bsaksida wrote: Warning 1 The type initializer for '' threw an exception.
Not sure about this. Might not be due to code shown by you.
bsaksida wrote: Warning 2 The variable 'lstListUsers' is either undeclared or was never assigned. 0 0
Again, this warning doesn't seem to be due to shown code. Where it takes you in the code ? if you click on them.
|
|
|
|
|
It doesn't take me anywhere.
In my solution i added a project(dll) with name ListViewFlickerFree.
declared as lstListUsers.
ListViewFlickerFree ^lstListUsers;
When i had it inside my main project. Sometimes my Design View printed out a an error, instead form. Even if source code didn't change. Sometimes to get it back i had to manualy delete all autogenerated files. Not yust using clean. but also delete .ncb, .suo files
|
|
|
|
|
prasad_som wrote: bsaksida wrote:
Warning 1 The type initializer for '' threw an exception.
Not sure about this. Might not be due to code shown by you.
Fixed that by deliting .ncb and .suo files.
prasad_som wrote: bsaksida wrote:
Warning 2 The variable 'lstListUsers' is either undeclared or was never assigned. 0 0
Again, this warning doesn't seem to be due to shown code. Where it takes you in the code ? if you click on them.
Fixed that:
I had to use batch Build to build the second project(dll) as debug and release
|
|
|
|
|
|
Hi, recently I've found this article: State Pattern in C++ Applications. I've got some questions regarding it.
1. I understand the state can change to another from the state itself. And I saw in the demo there's a forward declaration of GameState in GameStateManager. Is this a good practice?
2. If in each state there's a substate, what should I do? Eg. in Opening there's the AttrackState, CreditState, DemoState, etc.
3. If in each state there's an instance to the same pointer of object (e.g. the GameData pointer of object), what should I do?
Thanks.
"I live for my dream. And my dream is to live my life to the fullest."
|
|
|
|
|
Benang wrote: Hi, recently I've found this article: State Pattern in C++ Applications. I've got some questions regarding it.
1. I understand the state can change to another from the state itself. And I saw in the demo there's a forward declaration of GameState in GameStateManager. Is this a good practice?
2. If in each state there's a substate, what should I do? Eg. in Opening there's the AttrackState, CreditState, DemoState, etc.
3. If in each state there's an instance to the same pointer of object (e.g. the GameData pointer of object), what should I do?
You might want to direct your questions to the article author. You can post a message at the bottom of the article...
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Ah sorry about that. Didn't realized it. Thanks.
"I live for my dream. And my dream is to live my life to the fullest."
|
|
|
|
|
No worries
"That's no moon, it's a space station." - Obi-wan Kenobi
|
|
|
|
|
I am developing an application, and in mine solution there are 3 projects. One of them is MySql Connector 5.02, Witch is build in c#.
I am developing in c++/cli. mysql connector uses Mysql.data.dll
But i wan't to publish my project as opensource, and is server/client based, so i used a lot of #define dirrective to compile with password and other setting, needet to connect to server. When someone woud see a code, he coud get an idea to modify yust mysql connector, to get password, so i came here to ask a specific question. Is it possible to use seperate project to include in another project without using dll, but to include directly to exe? And without any special port to my project. (like inserting with asm or modify to c++/cli)
|
|
|
|
|
i have array with 5 declerated items, but i wan't to add another.
I don't want to execute the code twice, yust first for count to see how many declerations is needed, secund time to declare array with n items, as counted before.
I don't like to use another array as predefine, to backup and redeclare first array with index+1 and then copy from temp array back.
I know it is possible in managed c++, but i am using c++/cli (With .NET framework 2.0) and i don't wan't to use with compiler /cli:old
|
|
|
|
|
Use the 'Resize' method of the Array class.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: VB to Python converter
|
|
|
|