I am doing a from the ground up coding of my program using VS to find out what is going wrong.
When i entered some buttons i wanted to make,
I received the following warning from VS:
Linking...
LINK : E: \My docs\Visual Studio 2008\Projects\unicodetest\Debug\unicodetest.exe not found or not built by the last incremental link; performing full link
Embedding manifest...
It turns out that my hInstance is not initialized to 0.
When i type this : HINSTANCE hInstance; >> The warning.
When i type this : HINSTANCE hInstance = 0; >> No warnings.
This fixed the warning.
Luckily the debugger popped up with a message that hInstance was not initialized or i would not have known this.
The following bold text is what i suspect went wrong while not setting the unicode option to disable immediately at the start of the project.
This is for a pure ascii program.
Code:
hWndButton = CreateWindowEx (NULL,
[B]"button"[/B],
[B]"Create configuration files"[/B],
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
i_cxChar * 30,
i_cyChar * 41,
75 * i_cxChar,
12 * i_cyChar / 4,
hWnd,
(HMENU) i, // CHILD window ID 1.
hInstance,
NULL);
This bold text is what is expected when you use unicode :
Code:
hWndButton = CreateWindowEx (NULL,
[B]TEXT("button")[/B],
[B]TEXT("Create configuration files")[/B],
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
i_cxChar * 30,
i_cyChar * 41,
75 * i_cxChar,
12 * i_cyChar / 4,
hWnd,
(HMENU) i, // CHILD window ID 1.
hInstance,
NULL);
When i assumed unicode was standard off, which was the default according to my books, multiple of these TEXT() macro errors is what caused mayor errors in VS. But i did not get specific information about this. I would get linker errors. Just like the one above about the hInstance is not that obvious. Even after setting unicode to not set would no longer remove the error. VS was lost too i guess. Now since i started from the beginning with unicode not set i do not have any errors up till now.
When i use strcpy and other functions i used to get the following warning.
e: \my docs\visual studio 2008\projects\unicodetest\unicodetest\drawfunctions.cpp(547) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c: \program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
To remove this waring i typed the following defines on the top of the *.cpp where the errors are generated. Since i do a lot of parsing and stringsize checking myself, i do not feel the need to use the "save" versions. Redundancy is a fine concept but one can go to far...
#define _CRT_SECURE_NO_DEPRECATE
This i read as tip on daniweb. I have it commented out for now.
//#define _CRT_NONSTDC_NO_DEPRECATE
For anyone that might be interested :
http://www.daniweb.com/forums/thread137036.html
http://msdn.microsoft.com/en-us/library/ms235384.aspx
http://msdn.microsoft.com/en-us/library/8ef0s5kh.aspx
I am used to the following way to make sure a headerfile is not called multiple times by the compiler.
The include guard :
Code:
#ifdef ___MAFIGEN_DRAWFUNCTIONS
#endif
#ifndef ___MAFIGEN_DRAWFUNCTIONS
#define ___MAFIGEN_DRAWFUNCTIONS
// Include files
...
..
// Declare Prototypes !
...
...
#endif
To make sure this is not causing confusion to VS i decided to use the
#pragma once statement.
At the moment i have 0 warnings and 0 errors.

The problem is that the error messages of VS are really not always that clear and rather confusing. If i make a mistake or i forget something VS specific, i want to be notified what i do wrong and not with a obscure error message that is used for multiple different situations.
I write this all down, because i am sure i will not be the first or the last who has encountered these kinds of issues.