Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ::__argv ist NULL, but ::__argc is correct, why? Pin
jk chan26-Sep-11 3:52
jk chan26-Sep-11 3:52 
QuestionInstall LSP(Layered Service Provider) without a reboot? Pin
Syouki_kou25-Sep-11 20:28
Syouki_kou25-Sep-11 20:28 
Questionwrite multistring value to ADS key Pin
jkirkerx25-Sep-11 13:08
professionaljkirkerx25-Sep-11 13:08 
AnswerRe: write multistring value to ADS key Pin
Richard Andrew x6425-Sep-11 14:05
professionalRichard Andrew x6425-Sep-11 14:05 
GeneralRe: write multistring value to ADS key Pin
jkirkerx25-Sep-11 15:31
professionaljkirkerx25-Sep-11 15:31 
Questionreference prob with namespace C++ Pin
Schehaider_Aymen25-Sep-11 12:00
Schehaider_Aymen25-Sep-11 12:00 
AnswerRe: reference prob with namespace C++ Pin
Schehaider_Aymen25-Sep-11 12:39
Schehaider_Aymen25-Sep-11 12:39 
GeneralRe: reference prob with namespace C++ Pin
Emilio Garavaglia25-Sep-11 21:20
Emilio Garavaglia25-Sep-11 21:20 
What you did in your first post is correct.
The problem you run into is a LINKER problem, not compiler (if you are unsure about the difference, study a while how compile and linking process works)

Your "program" is actually made by two sources (main.cxx and foo.cxx): you have to compile them both, and link them together to produce a final executable. both the files must be inside your "project" configuration.


By placing the function definition in the header you solved the problem because now everything you need in known to main.cxx (that's probably the only file you compiled) But if you compile bot files now you will get a "symbol defined more than once" linked error.

So either:
- use separate files, but compile them all
- use only a single "cxx" and define everything the the header. But -in this second case- declare the functions you will define at header level as "inline" (inline int add(int a, int b) { ... }) to avoid multiple definitions in case of multiple compilations.

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


GeneralRe: reference prob with namespace C++ Pin
Schehaider_Aymen25-Sep-11 22:48
Schehaider_Aymen25-Sep-11 22:48 
GeneralRe: reference prob with namespace C++ Pin
Richard MacCutchan25-Sep-11 23:03
mveRichard MacCutchan25-Sep-11 23:03 
QuestionHow to use CMimeMessage to send a mail with attached file? Pin
yu-jian25-Sep-11 3:44
yu-jian25-Sep-11 3:44 
AnswerRe: How to use CMimeMessage to send a mail with attached file? Pin
André Kraak25-Sep-11 4:38
André Kraak25-Sep-11 4:38 
QuestionWatch cannot find symbol $x Pin
AlecJames24-Sep-11 4:35
AlecJames24-Sep-11 4:35 
AnswerRe: Watch cannot find symbol $x Pin
Richard MacCutchan24-Sep-11 5:56
mveRichard MacCutchan24-Sep-11 5:56 
GeneralRe: Watch cannot find symbol $x Pin
Albert Holguin24-Sep-11 6:34
professionalAlbert Holguin24-Sep-11 6:34 
GeneralRe: Watch cannot find symbol $x Pin
Richard MacCutchan24-Sep-11 6:43
mveRichard MacCutchan24-Sep-11 6:43 
QuestionVC++ Graphs. Pin
Vijay Rajanna23-Sep-11 7:08
Vijay Rajanna23-Sep-11 7:08 
AnswerRe: VC++ Graphs. Pin
Rajesh R Subramanian23-Sep-11 7:20
professionalRajesh R Subramanian23-Sep-11 7:20 
AnswerRe: VC++ Graphs. Pin
Albert Holguin23-Sep-11 8:36
professionalAlbert Holguin23-Sep-11 8:36 
AnswerRe: VC++ Graphs. Pin
Vijay Rajanna23-Sep-11 9:01
Vijay Rajanna23-Sep-11 9:01 
GeneralRe: VC++ Graphs. Pin
Software_Developer23-Sep-11 9:37
Software_Developer23-Sep-11 9:37 
AnswerRe: VC++ Graphs. Pin
Cedric Moonen25-Sep-11 20:31
Cedric Moonen25-Sep-11 20:31 
QuestionCan I use a SetTimer() API in a console c++ app. Pin
JosephJohnAllen23-Sep-11 5:57
JosephJohnAllen23-Sep-11 5:57 
AnswerRe: Console SetTimer Pin
Software_Developer23-Sep-11 6:14
Software_Developer23-Sep-11 6:14 
GeneralRe: Console SetTimer Pin
Albert Holguin23-Sep-11 8:39
professionalAlbert Holguin23-Sep-11 8:39 

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.