User forums > Using Code::Blocks
Help with using code::blocks
blindtolive:
So i have just started learning C++ and i started with the hello world tutorials and that went good i got it to open no problem butnow i am trying to do the calculator like so
#include <iostream>
int add(int x, int y)
{
// add the numbers x and y together and return the sum
std::cout << "running calculator...\n";
return (x+y)
}
int main()
{
/*this program calls an add() function to add two diffrent sets of numbers together and displays the results. the add() function dosnt do anything unless it is called by a line in the main() function. */
std::cout << "what is 867 + 5309?\n";
std::cout << "the sum is " << add(867, 5309) << "\n\n";
std::cout << "what is 777 + 9311?\n";
std::cout << "the sum is " << add(777, 9311) << "\n";
return 0;
}
and it keeps opening the Hello World window when i click run on the calculator...i notice to that in my files folder it auto creates a main.cpp...i figure its something im doing wrong but i cant pinpoint it any help would be much appreciated.
thanks in advance
stahta01:
Turn on Full Compiler Logging; then read/post the full compiler log after doing re-build of the project.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Tim S.
zabzonk:
--- Quote ---i notice to that in my files folder it auto creates a main.cpp
--- End quote ---
Put your code in the auto-created main.cpp.
blindtolive:
so i turned on full compiler logging i just wasnt 100% sure where to get the log but i hope this is right
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Users\owner\Desktop\C++\calc\
Adding source dir: C:\Users\owner\Desktop\C++\calc\
Adding file: bin\Debug\calc.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8
Child process PID: 6104
Program exited normally.
Debugger finished with status 0
i started from scratch and remade it and still opens the Hello World instead
stahta01:
Please post the Build log (after turning on FULL COMPILER LOGGING) not the log you posted after you do a re-build of project.
You likely are NOT compiling the right file.
NOTE: to do a re-build choose "rebuild" from the "build" menu.
Tim S.
Navigation
[0] Message Index
[#] Next page
Go to full version