New to C++
- noxiousraccoon
- Posts: 441
- Joined: Wed May 17, 2006 2:54 pm
New to C++
Had a quick question involving compiling code. Does a c++ compiler actually output a program, or does it just compile it so you can use it later? I am using Windows Visual C++ as my compiler. I am familiar with Java and Dr. Scheme so the language shouldnt be too hard to comprehend, though I cant quite figure out how to actually get my programs to run.
After compiling I get this:
1>Testing - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
So I am pretty confident my code is correct, though I see no output. Anyone have a suggestion?
Also, if anyone is willing. After looking at the language, I havent quite figured out the use of (*) or the pointer. I have looked at tutorials and such, but I really dont see what it is actually doing. Could anyone enlighten me? I would appreciate it.
After compiling I get this:
1>Testing - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
So I am pretty confident my code is correct, though I see no output. Anyone have a suggestion?
Also, if anyone is willing. After looking at the language, I havent quite figured out the use of (*) or the pointer. I have looked at tutorials and such, but I really dont see what it is actually doing. Could anyone enlighten me? I would appreciate it.
it should be in the "bin" folder in the directory which you saved the project to
Halo 2 Plugins | Lock-on To Just About Anything | My Sites | Snow Hog
Old Plugins you have, upgrade you must...
Always Maintain a High Quality-To-Crap Ratio.
- noxiousraccoon
- Posts: 441
- Joined: Wed May 17, 2006 2:54 pm
Dr Scheme is a program that has support for multiple languages, I'm assuming you mean you prefer the scheme language. I don't like the syntax of it personally, that's what I started in for computers, besides a brief course that use VB.net As for you question about pointers, I believe that when you use * it declares a pointer variable, which stores an address to the location of an object in memory. I would try to explain more but I'm not positive on everything so I don't want to tell you incorrect information.
- noxiousraccoon
- Posts: 441
- Joined: Wed May 17, 2006 2:54 pm
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
- noxiousraccoon
- Posts: 441
- Joined: Wed May 17, 2006 2:54 pm
Im really just interested in learning more languages, not really looking for advantages or disadvantages.Patrickssj6 wrote:Maybe you should learn the advantages of programs based off an intermediate language running inside the .NET environment...you would never want to go back to python.
Also, C# supports pointer controls and unsafe programming.
Does anyone have a suggestion on the compiler problem?
imo visual studio isn't that great of an IDE, although that might just be because i'm used to working in dev-c++ (it's free and uses the g++ compiler). i'm also not sure what compiler visual studio uses, so i'm not sure if i could help you on that, since i don't know where it puts the program after it's compiled, but it should just be a matter of finding it. once you've found it, if it disappears when you double-click it you'll want to try navigating to it in the command line and running it from there.
c++ compilers take your code, do something called linking i'm not familiar with involving object files or something, then compile those into a single executable file in machine language (iirc).
as for pointers, like 0wnz said, they're a variable that holds a memory address. you'll declare them like this: "int *pointer;" and assign addresses to them with the dereferencing operator ("&"). like this if i'm not too rusty.
now such statements will be equal:
they're good for dealing with large amounts of data, like if you made a class that holds large amounts of info, then have a function that compares two classes. instead of passing the entire classes to the function and having to copy all that data, you could simply pass it the address of the classes in memory, so it can work with them directly and only move around a few bytes of info (the addresses). you probably won't have to worry about working with them for a while, i still don't use them much.
c++ compilers take your code, do something called linking i'm not familiar with involving object files or something, then compile those into a single executable file in machine language (iirc).
as for pointers, like 0wnz said, they're a variable that holds a memory address. you'll declare them like this: "int *pointer;" and assign addresses to them with the dereferencing operator ("&"). like this if i'm not too rusty.
Code: Select all
int *pointer; //pointer declared, but not initialized
int target; //what we'll point to. declared, but not initialized, so it holds junk data.
pointer = ⌖ //pointer = address-of target.
Code: Select all
*pointer = 42; //i'm fairly sure this is right, i might be wrong on putting the * there, though.
target = 42;
ASPARTAME: in your diet soda and artificial sweeteners. also, it's obviously completely safe. it's not like it will cause tumors or anything. >.>
always remember: guilty until proven innocent
always remember: guilty until proven innocent
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
If you compile a file inside the .NET Framework it gets converted into the IL (Intermediate Language). They are all Exe files and by that all PE files but there is an essential difference. .NET Application get decompiled on startup and get optimized for the used CPU (from IL to MachineCode)...[cc]z@nd! wrote: c++ compilers take your code, do something called linking i'm not familiar with involving object files or something, then compile those into a single executable file in machine language (iirc).
...left for good
- FleetAdmiralBacon
- Posts: 2377
- Joined: Sat Nov 26, 2005 7:01 pm
- Location: Ohio
- Contact:
A PE isn't technically machine code. The process used when running a .NET application is dynamic translation, the CLR takes your MSIL executable and performs a JIT compilation on it to make native code, but they are not decompiled. (Also, as a note, not all EXEs are PEs, even up in Vista you still have a few LEs or even possibly an MZ (gasp!). I think I've also seen an NE or two as well, old 16-bit programs still lurk in the core...)Patrickssj6 wrote: If you compile a file inside the .NET Framework it gets converted into the IL (Intermediate Language). They are all Exe files and by that all PE files but there is an essential difference. .NET Application get decompiled on startup and get optimized for the used CPU (from IL to MachineCode)...
Everything you'll ever need to know about me.
Need help with Linux, C#, C, Python, Java, PHP, Javascript, CSS, or VB? I'm available from 3:00PM-8:00PM EST on weekdays.
- noxiousraccoon
- Posts: 441
- Joined: Wed May 17, 2006 2:54 pm
I didnt put it in that location, but where i do have it, it doesnt have a bin folder. Only a 'debug' file, the necessary source code files, and a few others.McT0asT wrote:Try looking in thenoxiousraccoon wrote: Does anyone have a suggestion on the compiler problem?
"C:\Documents and Settings\*USERNAME*\My Documents\Visual Studio 200*\Projects\*Project Name*\*Project Name*\bin\Release" folder
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
Yeah thanks. I wanted to keep it short and understandableFleetAdmiralBacon wrote:A PE isn't technically machine code. The process used when running a .NET application is dynamic translation, the CLR takes your MSIL executable and performs a JIT compilation on it to make native code, but they are not decompiled. (Also, as a note, not all EXEs are PEs, even up in Vista you still have a few LEs or even possibly an MZ (gasp!). I think I've also seen an NE or two as well, old 16-bit programs still lurk in the core...)Patrickssj6 wrote: If you compile a file inside the .NET Framework it gets converted into the IL (Intermediate Language). They are all Exe files and by that all PE files but there is an essential difference. .NET Application get decompiled on startup and get optimized for the used CPU (from IL to MachineCode)...
...left for good