PDA

View Full Version : KDevelop and C++



jjesurun
16th April 2008, 03:20 AM
Can somebody tell me how to compile and run c++ files on the KDevelop , because i'm lost in there, i opened the file, but no buttons that says run or compile.

ausadl
16th April 2008, 04:29 AM
You have to create/open a project first.

jjesurun
16th April 2008, 12:22 PM
i did create a project, but how do i create i blank project, i chose to create a simple kde application and when it open it had the hello world code. Then i commented it out and wrote my code and couldn't compile it or run it

markkuk
16th April 2008, 12:46 PM
If your code doesn't compile correctly, then it isn't a valid KDE application. See the error messages given by the compiler and fix the bugs in your program.

jjesurun
16th April 2008, 01:08 PM
this is the code i wrote, simple hello world from my book
#include <iostream>

int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
and this is what i get when i execute it:

cd '/home/JJ/Desktop/C++Files/HW/debug/./src' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" LC_MESSAGES="C" LC_CTYPE="C" gmake -k hw
compiling hw.cpp (g++)
mv -f .deps/hw.Tpo .deps/hw.Po
linking hw (libtool)
hw.o: In function `main':
/home/JJ/Desktop/C++Files/HW/src/hw.cpp:6: multiple definition of `main'
main.o:/home/JJ/Desktop/C++Files/HW/src/main.cpp:20: first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 497 in main.o to 67 in hw.o
main.o: In function `main':
main.cpp:(.text+0x12b): undefined reference to `HW::HW()'
main.cpp:(.text+0x17e): undefined reference to `HW::HW()'
collect2: ld returned 1 exit status
gmake: *** [hw] Error 1
*** Exited with status: 2 ***


Why am i getting that output and what does it mean?? And how can i get a blank project when i create one????

ausadl
16th April 2008, 01:30 PM
Create 'Simple Hello World project'

markkuk
16th April 2008, 02:53 PM
You created a KDE application project, but started writing a standard C++ command-line program. Your project gets compiled as a KDE program and fails because it's not a valid KDE application. As ausadl wrote, you must start with a non-KDE project template to create a command-line only program. Use "Empty Autotools Template" or "Empty Custom Makefile Template" to create a project without pre-written source and header files.