I have the following c files.
prog1.h
#ifndef PROG1_H
#define PROG1_H
extern char* hello;
#endif
prog1.c
#include "prog1.h"
char *hello="hello";
one.c
#include "prog1.h"
#include <stdio.h>
int main(){
printf("%s", hello);
}
CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(tester)
add_executable(main one.c)
add_executable(prog1 prog1.c)
On attempt of building the project "tester" in KDevelop I get the following output.
output log generated in KDevelop on building the project
But when I compile the file explicitly on terminal by the command -
gcc one.c prog1.c -o outputfile
it returns me the "outputfile" which on running -
./outputfile
i get the desired output
akash@Z50-70:~/projects/Tester$ gcc one.c prog1.c -o outputfile
akash@Z50-70:~/projects/Tester$ ./outputfile
hello
akash@Z50-70:~/projects/Tester$
Can anyone help me out with the issue i am facing while trying to build the project in KDevelop?