N
nhkrishna
Guest
I'm trying to build the file which is presented at the UNC path. Here i'm providing simple example to get more clarity.
main.cpp
#include <iostream>
#include "additionApi.hpp"
int main(){
int a=10, b=20;
std::cout<<"Addition:"<<addNumbers(a,b);
return 0;
}
tmpOperation\additionApi.hpp
int addNumbers(int a, int b);
tmpOperation\additionApi.cpp
#include <iostream>
int addNumbers(int a, int b){
return a+b;
}
tmpOperation\Makefile
tmpOperationDir = \\unc\path\location\tmpOperation
%.obj:%.cpp
cl /TP /Od /Oy- -Zi /EHsc -I"." -I"$(tmpOperationDir)" /c $< /Fo$@
../math_exe:additionApi.obj ../main.obj
link /OUT:../math.exe additionApi.obj ../main.obj
all:../math_exe
In the above file structure, i'm using make command from the tmpOperaion directory. main.cpp is presented at outside of the tmpOperaion directory. So i'm accessing main.cpp using the relative path as ../main.cpp in Makefile. But it is unable to build the main file and giving the following error.
gmake: *** No rule to make target `../main.obj', needed by `../math_exe'. Stop.
So finally, below are my straight forward questions:
Continue reading...
main.cpp
#include <iostream>
#include "additionApi.hpp"
int main(){
int a=10, b=20;
std::cout<<"Addition:"<<addNumbers(a,b);
return 0;
}
tmpOperation\additionApi.hpp
int addNumbers(int a, int b);
tmpOperation\additionApi.cpp
#include <iostream>
int addNumbers(int a, int b){
return a+b;
}
tmpOperation\Makefile
tmpOperationDir = \\unc\path\location\tmpOperation
%.obj:%.cpp
cl /TP /Od /Oy- -Zi /EHsc -I"." -I"$(tmpOperationDir)" /c $< /Fo$@
../math_exe:additionApi.obj ../main.obj
link /OUT:../math.exe additionApi.obj ../main.obj
all:../math_exe
In the above file structure, i'm using make command from the tmpOperaion directory. main.cpp is presented at outside of the tmpOperaion directory. So i'm accessing main.cpp using the relative path as ../main.cpp in Makefile. But it is unable to build the main file and giving the following error.
gmake: *** No rule to make target `../main.obj', needed by `../math_exe'. Stop.
So finally, below are my straight forward questions:
- can we build a file(main.cpp in the given example) relatively from the UNC path ?
Continue reading...