Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
David Crow14-Jun-16 5:23
David Crow14-Jun-16 5:23 
SuggestionRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
Peter_in_278014-Jun-16 16:53
professionalPeter_in_278014-Jun-16 16:53 
GeneralRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
Member 1248511614-Jun-16 19:18
Member 1248511614-Jun-16 19:18 
GeneralRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
Jochen Arndt14-Jun-16 21:19
professionalJochen Arndt14-Jun-16 21:19 
GeneralRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
leon de boer15-Jun-16 4:11
leon de boer15-Jun-16 4:11 
GeneralRe: SHA1- CheckSum Example in Microsoft Visual C++ 6.0 Pin
David Crow15-Jun-16 1:53
David Crow15-Jun-16 1:53 
QuestionLarge project how to seprate definition and declaration? Pin
Hassan Syed112-Jun-16 9:47
Hassan Syed112-Jun-16 9:47 
AnswerRe: Large project how to seprate definition and declaration? Pin
leon de boer12-Jun-16 17:38
leon de boer12-Jun-16 17:38 
It should be avail able on any tutorial on the net but lets do a basic.

The header file .h is where you put anything that needs to be accessed from another unit. Your functions etc are just prototype declarations. You generally put a guard #ifndef around it to stop it being included multiple times if called from multiple units.

So "mycode.h" would be something like
#ifndef _MYCODE_
#define _MYCODE_

// Place public defines, structures  etc here .. random couple of sample defines as example
#define DEV_OK			0	// No device error
#define DEV_ERROR       -1	// Device access error

// Some prototype functions I will define in the main body file
void MyFunction1 (int someValue);
int MyFunction2 (void);

#endif 


Now for the body file MyCode.cpp
#include "mycode.h"  // Include your own header file

// Private internal stuff not visible outside the unit because its not in .H file

// An private integer which will just hold our function value
int CurrentValue = 0;

// Our prototype functions now get code

void MyFunction1 (int someValue){
   CurrentValue = someValue;    // Lets just hold value passed in
}

int MyFunction2 (void){
   return (currentValue);       // Just return current value
}

That is all there is to it as a minimalist code sample.
In vino veritas

GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed112-Jun-16 18:34
Hassan Syed112-Jun-16 18:34 
GeneralRe: Large project how to seprate definition and declaration? Pin
Jochen Arndt12-Jun-16 21:47
professionalJochen Arndt12-Jun-16 21:47 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer12-Jun-16 22:37
leon de boer12-Jun-16 22:37 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 1:25
Hassan Syed113-Jun-16 1:25 
GeneralRe: Large project how to seprate definition and declaration? Pin
Richard MacCutchan13-Jun-16 1:46
mveRichard MacCutchan13-Jun-16 1:46 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer13-Jun-16 4:03
leon de boer13-Jun-16 4:03 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 4:54
Hassan Syed113-Jun-16 4:54 
SuggestionRe: Large project how to seprate definition and declaration? Pin
David Crow13-Jun-16 5:23
David Crow13-Jun-16 5:23 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer13-Jun-16 16:19
leon de boer13-Jun-16 16:19 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed113-Jun-16 19:47
Hassan Syed113-Jun-16 19:47 
AnswerRe: Large project how to seprate definition and declaration? Pin
David Crow14-Jun-16 2:47
David Crow14-Jun-16 2:47 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 6:06
leon de boer14-Jun-16 6:06 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 10:01
leon de boer14-Jun-16 10:01 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed114-Jun-16 20:34
Hassan Syed114-Jun-16 20:34 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 3:53
leon de boer15-Jun-16 3:53 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 4:32
Hassan Syed115-Jun-16 4:32 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 6:21
leon de boer15-Jun-16 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.