Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with __attribute__ #13

Open
cherry-wb opened this issue Sep 3, 2021 · 0 comments
Open

error with __attribute__ #13

cherry-wb opened this issue Sep 3, 2021 · 0 comments

Comments

@cherry-wb
Copy link

Hello, I can not use ccr to compile code below, the error message like this:
root@b94c935ff494:/CCR/test# ccr++ -o ./funcptr ./funcptr.c
clang-3.9: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
[CCR-ERROR] Was not able to find the offset@.text for /tmp/funcptr-f2e918.o
ld: object.h:1459: uint64_t gold::Relobj::yarp_object_id(std::__cxx11::string): Assertion `0' failed.
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: linker command failed due to signal (use -v to see invocation)

#include
using namespace std;
#include <stdio.h>
#include <unistd.h>
#define CTOR_PRIO 3

attribute((constructor(CTOR_PRIO)))
void __cbsr_auto_early(void) {
fprintf(stderr,"__cbsr_auto_early。");
}

attribute((constructor()))
void __cbsr_auto_early_1(void) {
fprintf(stderr,"__cbsr_auto_early_1。");
}
int main() {
int a = 10;
int b = 20;
int c;
while(true){
printf("%d + %d = %d\n",a,b,c);
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
sleep(1);
}
return 0;
}

is there anything wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant