Forum
Off Topic C++ TutorialEdit
Nvm the console output tells the path
edit
It is not there
edit again
nvm I found it
Edit
Could you explain how to add something like FMOD, OGRE, GTK+ etc.?
Edit
Got VC++ to build some Irrlicht code without errors, but their is no exe. Says it created one, but it lies :(.
Log:
VC++ Build Log has written
1>------ Build started: Project: 01.HelloWorld, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\irrlicht-1.7.1\irrlicht-1.7.1\examples\01.HelloWorld\.\Debug\01.HelloWorld.exe) does not match the Linker's OutputFile property value (C:\irrlicht-1.7.1\irrlicht-1.7.1\bin\Win32-VisualStudio\01.HelloWorld.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1> HelloWorld.vcxproj -> C:\irrlicht-1.7.1\irrlicht-1.7.1\examples\01.HelloWorld\.\Debug\01.HelloWorld.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(C:\irrlicht-1.7.1\irrlicht-1.7.1\examples\01.HelloWorld\.\Debug\01.HelloWorld.exe) does not match the Linker's OutputFile property value (C:\irrlicht-1.7.1\irrlicht-1.7.1\bin\Win32-VisualStudio\01.HelloWorld.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1> HelloWorld.vcxproj -> C:\irrlicht-1.7.1\irrlicht-1.7.1\examples\01.HelloWorld\.\Debug\01.HelloWorld.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
edited 3×, last 14.08.10 04:04:42 am
Oh haha, I just opened up VC++ and saw a few projects of mine from a long time ago and realized how I used to develop:
Step 1. Write the application using the VC++ IDE complete with its great set of code analysis functionality
Step 2. Make the necessary changes to ensure smooth compilation with G++
Step 3. g++ *.c -I"C:\...\include" -L"C:\...\libs" -l... -oOut -w [-shared] >.<
I guess I should probably just use VC++'s build tools now.
edited 1×, last 14.08.10 04:49:52 am
1
2
3
4
5
6
7
2
3
4
5
6
7
int* getANSIArray (char chr) { 	int a[sizeof(chr)/sizeof(char)]; 	for (int i = 0; i<=sizeof(chr)/sizeof(char); i++) { 		a[i] = int (chr[i]); 	} 	return a; }
I get an error at a[i] = int (char[i])
"Expression must have a pointer-to-object"
I have also used
a[i] = (int) char[i]
with the same error
You are doing it wrong.
1
a[i] = (int)chr[i];
Btw, if you want to convert chains of characters, you will have to use strlen() and char*.
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
int* getANSIArray(char* chr) //Accepts more than 1 par. { int a[strlen(chr)];//sizeof doesn't work with pointers, only with constant arrays for(int i=0; i<strlen(chr); i++) { a[i] = (int)chr[i]; } a[strlen(chr)] = '\0'; //NEVER forget about the null terminating character }
Edit: I googled about the error your compiler threw. The problem was that you were indexing a single character (chr was just a char, not a char*)
edited 2×, last 15.08.10 05:39:10 am
Flacko has written
Type casting
You are doing it wrong.
You are doing it wrong.
Thanks, but if you read my post you will clearly see that I said I did it that way also. And both ways will work. http://www.cplusplus.com/doc/tutorial/typecasting/
Edit:
Yours won't work because strlen(char) is not constant.
Edit:
Is there a way to turn on line numbers in VC++?
In that case you will have to type cast once again every time you pass the parameter to the compiler.
1
(const char*)chr
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
int main() { 	char c[] = "hello, world"; 	int i = getANSIChar(c[1]); 	short a[sizeof(c)/sizeof(char)]; 	for (int it = 0; i<=sizeof(c)/sizeof(char); i++) 		a[it] = short (c[it]); 	cout << a[2] << endl; 	system("pause"); 	return 0; }
Edit
Nvm! I found it! I used i instead it
Edit:
Would something like this work? I just want to convert a character in a string to a char.
1
2
3
2
3
string s("ima string"); char c; c = s.substr(3,0);
Edit
It is if I use
1
2
3
2
3
string s("ima string"); char c; c = (char) s.substr(3,0).c_str();
edited 3×, last 15.08.10 07:18:25 am
Edit
What is the problem with this?
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
#include <iostream> using namespace std; #define str(s) #s #define combine(v,...) v ## ... int main() { 	cout << combine(str(str), str(ing)) << endl; 	system("pause"); 	return 0; }
Edit
I am going to use SDL. Should I select Console App or Windowed? (in VC++, I think I know the answer but I must be sure)
edited 4×, last 31.08.10 04:14:27 am
Console app is just like a hello world in Dev.
BTW, read this guy's tutorial, I learnt some lua thanks to his website
http://gamedevgeek.com/tutorials/getting-started-with-sdl/
SDL initialize it's windows on it's own, so you will not need to call the windows API by yourself (luckly)
If you didn't like Dev-C++ nor VC++ you can still try Code::Blocks, which comes with the MingW32 compiler, which I find a lot more user-friendly than Microsoft's.
I have tried VC++ (for a very short while), Dev, wxDev and Code::Blocks, and I'm sticking with wxDev even though it throws errors on almost every action I perform, it includes it's own VisualBasic-like API, wxWidgets, which is cool :D, even though I'm not very interested into it because I use to integrate my own-written rustic GUI system in my games
http://www.winprog.org/tutorial/start.html
It also includes some new datatypes
http://msdn.microsoft.com/en-us/library/aa383751%28VS.85%29.aspx
And more stuff...