hello,
well I have been struggling with something that makes absolutely no sense to me for the past hour now.
for some reason, my compiler (MSVC++ 6.0) will not let me use the C++ string class. I have included the string header, but am guessing it is missing alot of declarations or something.
Firstly, I tried using a C-style null terminated char array for a string. then I found MSVC++ does not have the strings.h. so now I try to use the C++ string class, and get "undeclared identifier" on the line that my identifier exists on . please take a look at this and try to point out something that I am doing wrong (I am guessing I'll have to write my own string class and include it in a new header to fix it ):
Code:
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
#include <commdlg.h>
#include <string>
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
string szFileName1("");
string szFileName2("");
that would declare strings with the identifiers of "szFileName1" and "szFileName2"? correct???? I am using the ("") for safety and clarity purposes. so then I try this:
Code:
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
#include <commdlg.h>
#include <string>
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
char szFileName1[] = "";
char szFileName2[] = "";
string F1(szFileName1);
string F2(szFileName2);
and I still get the undeclared identifier error . I read up on the error and its description says its usually caused by a variable declaration with no type specified. but I don't see where there are ANY missing types (not unless they are in the included string.h like I said), the variables you see in first example should be of type string, and the second example should be null terminated char arrays (c-style strings) which then get defined as strings called F1 and F2. so can someone here please tell me what the heck I am doing wrong ????
thank you in advance